| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace Metricool\Http\Endpoints\Responses\Statistics; |
| 6 |
|
| 7 |
use Metricool\Http\Endpoints\Responses\DistributionResponse; |
| 8 |
use Metricool\Http\Metricool\DTOs\DistributionDTO; |
| 9 |
|
| 10 |
class RefererResponse extends DistributionResponse |
| 11 |
{ |
| 12 |
/** |
| 13 |
* @inheritDoc |
| 14 |
*/ |
| 15 |
public function parseSingleItem(DistributionDTO $item, int $total): object |
| 16 |
{ |
| 17 |
return (object) [ |
| 18 |
'url' => $item->value, |
| 19 |
'pageViews' => $item->amount, |
| 20 |
'percentage' => $item->calculatePercentageFromTotal($total), |
| 21 |
]; |
| 22 |
} |
| 23 |
} |
| 24 |
|