| @@ 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 |
|
| @@ 101-118 (lines=18) @@ | ||
| 98 | * @param Carbon $toDate |
|
| 99 | * @return Collection |
|
| 100 | */ |
|
| 101 | public function rankingDistributions($siteID, Carbon $fromDate, Carbon $toDate): Collection |
|
| 102 | { |
|
| 103 | $this->checkMaximumDateRange($fromDate, $toDate); |
|
| 104 | ||
| 105 | $response = $this->performQuery('sites/ranking_distributions', ['id' => $siteID, 'from_date' => $fromDate->toDateString(), 'to_date' => $toDate->toDateString()]); |
|
| 106 | ||
| 107 | $rankDistribution = collect($response['RankDistribution']); |
|
| 108 | ||
| 109 | if (isset($response['RankDistribution']['date'])) { |
|
| 110 | $rankDistribution = collect([$response['RankDistribution']]); |
|
| 111 | } |
|
| 112 | ||
| 113 | $rankDistribution->transform(function ($distribution) { |
|
| 114 | return $this->transformRankDistribution($distribution); |
|
| 115 | }); |
|
| 116 | ||
| 117 | return $rankDistribution; |
|
| 118 | } |
|
| 119 | ||
| 120 | /** |
|
| 121 | * @param $projectID |
|