| @@ 97-114 (lines=18) @@ | ||
| 94 | * @param Carbon $toDate |
|
| 95 | * @return Collection |
|
| 96 | */ |
|
| 97 | public function rankingDistributions($siteID, Carbon $fromDate, Carbon $toDate) : Collection |
|
| 98 | { |
|
| 99 | $this->checkMaximumDateRange($fromDate, $toDate); |
|
| 100 | ||
| 101 | $response = $this->performQuery('sites/ranking_distributions', ['id' => $siteID, 'from_date' => $fromDate->toDateString(), 'to_date' => $toDate->toDateString()]); |
|
| 102 | ||
| 103 | $rankDistribution = collect($response['RankDistribution']); |
|
| 104 | ||
| 105 | if (isset($response['RankDistribution']['date'])) { |
|
| 106 | $rankDistribution = collect([$response['RankDistribution']]); |
|
| 107 | } |
|
| 108 | ||
| 109 | $rankDistribution->transform(function ($distribution) { |
|
| 110 | return $this->transformRankDistribution($distribution); |
|
| 111 | }); |
|
| 112 | ||
| 113 | return $rankDistribution; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * @param $projectID |
|
| @@ 61-78 (lines=18) @@ | ||
| 58 | * @param Carbon $toDate |
|
| 59 | * @return Collection |
|
| 60 | */ |
|
| 61 | public function rankingDistributions($tagID, Carbon $fromDate, Carbon $toDate) |
|
| 62 | { |
|
| 63 | $this->checkMaximumDateRange($fromDate, $toDate); |
|
| 64 | ||
| 65 | $response = $this->performQuery('tags/ranking_distributions', ['id' => $tagID, 'from_date' => $fromDate->toDateString(), 'to_date' => $toDate->toDateString()]); |
|
| 66 | ||
| 67 | $rankDistribution = collect($response['RankDistribution']); |
|
| 68 | ||
| 69 | if (isset($response['RankDistribution']['date'])) { |
|
| 70 | $rankDistribution = collect([$response['RankDistribution']]); |
|
| 71 | } |
|
| 72 | ||
| 73 | $rankDistribution->transform(function ($distribution, $key) { |
|
| 74 | return $this->transformRankDistribution($distribution); |
|
| 75 | }); |
|
| 76 | ||
| 77 | return $rankDistribution; |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @param $siteID |
|