@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function boot() |
| 16 | 16 | { |
| 17 | 17 | $this->publishes([ |
| 18 | - __DIR__.'/config/laravel-stat-search-analytics.php' => config_path('laravel-stat-search-analytics.php'), |
|
| 18 | + __DIR__ . '/config/laravel-stat-search-analytics.php' => config_path('laravel-stat-search-analytics.php'), |
|
| 19 | 19 | ], 'config'); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function register() |
| 28 | 28 | { |
| 29 | - $this->mergeConfigFrom(__DIR__.'/config/laravel-stat-search-analytics.php', 'laravel-stat-search-analytics'); |
|
| 29 | + $this->mergeConfigFrom(__DIR__ . '/config/laravel-stat-search-analytics.php', 'laravel-stat-search-analytics'); |
|
| 30 | 30 | |
| 31 | 31 | $statConfig = config('laravel-stat-search-analytics'); |
| 32 | 32 | |
| 33 | - $this->app->bind(StatClient::class, function () use ($statConfig) { |
|
| 33 | + $this->app->bind(StatClient::class, function() use ($statConfig) { |
|
| 34 | 34 | if (empty($statConfig['key'])) { |
| 35 | 35 | throw InvalidConfiguration::keyNotSpecified(); |
| 36 | 36 | } |
| 37 | 37 | return StatClientFactory::createForConfig($statConfig); |
| 38 | 38 | }); |
| 39 | 39 | |
| 40 | - $this->app->bind(Stat::class, function () { |
|
| 40 | + $this->app->bind(Stat::class, function() { |
|
| 41 | 41 | $client = app(StatClient::class); |
| 42 | 42 | return new Stat($client); |
| 43 | 43 | }); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | $response = $this->performQuery('serps/show', ['keyword_id' => $keywordID, 'engine' => $engine, 'date' => $date->toDateString()]); |
| 21 | 21 | |
| 22 | - return collect($response['Result'])->transform(function ($ranking, $key) { |
|
| 22 | + return collect($response['Result'])->transform(function($ranking, $key) { |
|
| 23 | 23 | |
| 24 | 24 | return new StatSerpItem([ |
| 25 | 25 | 'result_type' => $ranking['ResultType'], |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | protected function checkMaximumDateRange(Carbon $fromDate, Carbon $toDate, $maxDays = 31) |
| 57 | 57 | { |
| 58 | 58 | if ($fromDate->diffInDays($toDate) > $maxDays) { |
| 59 | - throw ApiException::resultError('The maximum date range between from_date and to_date is '.$maxDays.' days.'); |
|
| 59 | + throw ApiException::resultError('The maximum date range between from_date and to_date is ' . $maxDays . ' days.'); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | } while ($response['resultsreturned'] < $response['totalresults']); |
| 38 | 38 | |
| 39 | 39 | |
| 40 | - $rankings = $rankings->transform(function ($ranking, $key) { |
|
| 40 | + $rankings = $rankings->transform(function($ranking, $key) { |
|
| 41 | 41 | return new StatKeywordRanking([ |
| 42 | 42 | 'date' => $ranking['date'], |
| 43 | 43 | 'google' => new StatKeywordEngineRanking([ |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | return collect(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - $tags = collect($response['Result'])->transform(function ($item, $key) { |
|
| 24 | + $tags = collect($response['Result'])->transform(function($item, $key) { |
|
| 25 | 25 | if ($item['Keywords'] == 'none') { |
| 26 | 26 | $item['Keywords'] = collect(); |
| 27 | 27 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $rankDistribution = collect([$response['RankDistribution']]); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $rankDistribution->transform(function ($distribution, $key) { |
|
| 60 | + $rankDistribution->transform(function($distribution, $key) { |
|
| 61 | 61 | return $this->transformRankDistribution($distribution); |
| 62 | 62 | }); |
| 63 | 63 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $subaccounts = collect(); |
| 21 | 21 | |
| 22 | - if (! isset($response['User'])) { |
|
| 22 | + if (!isset($response['User'])) { |
|
| 23 | 23 | return $subaccounts; |
| 24 | 24 | } |
| 25 | 25 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $subaccounts = collect($response['User']); |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - $subaccounts->transform(function ($item, $key) { |
|
| 32 | + $subaccounts->transform(function($item, $key) { |
|
| 33 | 33 | return new StatSubAccount([ |
| 34 | 34 | 'id' => $item['Id'], |
| 35 | 35 | 'login' => $item['Login'], |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $bulkJobs = collect($response['Result']); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - return $bulkJobs->transform(function ($job, $key) { |
|
| 37 | + return $bulkJobs->transform(function($job, $key) { |
|
| 38 | 38 | return new StatBulkJob([ |
| 39 | 39 | 'id' => $job['Id'], |
| 40 | 40 | 'job_type' => $job['JobType'], |
@@ -68,16 +68,16 @@ discard block |
||
| 68 | 68 | $arguments['currently_tracked_only'] = $currentlyTrackedOnly; |
| 69 | 69 | $arguments['crawled_keywords_only'] = $crawledKeywordsOnly; |
| 70 | 70 | |
| 71 | - if (! is_null($sites) && count($sites) > 0) { |
|
| 71 | + if (!is_null($sites) && count($sites) > 0) { |
|
| 72 | 72 | $arguments['site_id'] = implode(',', $sites); |
| 73 | 73 | ; |
| 74 | 74 | } |
| 75 | - if (! is_null($engines) && count($engines) > 0) { |
|
| 75 | + if (!is_null($engines) && count($engines) > 0) { |
|
| 76 | 76 | $arguments['engines'] = implode(',', $engines); |
| 77 | 77 | } |
| 78 | 78 | $response = $this->performQuery('bulk/ranks', $arguments); |
| 79 | 79 | |
| 80 | - return (int) $response['Result']['Id']; |
|
| 80 | + return (int)$response['Result']['Id']; |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function status($bulkJobID) |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $jobStatus->sites = collect(); |
| 94 | 94 | if (isset($response['Result']['SiteId'])) { |
| 95 | 95 | $jobStatus->sites = collect(explode(',', $response['Result']['SiteId'])) |
| 96 | - ->transform(function ($site, $key) { |
|
| 96 | + ->transform(function($site, $key) { |
|
| 97 | 97 | return (int)$site; |
| 98 | 98 | }); |
| 99 | 99 | } |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | $this->validateBulkDate($date); |
| 128 | 128 | |
| 129 | 129 | $response = $this->performQuery('bulk/tag_ranking_distributions', ['date' => $date->toDateString()]); |
| 130 | - return (int) $response['Result']['Id']; |
|
| 130 | + return (int)$response['Result']['Id']; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function get($bulkJobID) |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | { |
| 160 | 160 | $projects = $this->getCollection($bulkStream['Project']); |
| 161 | 161 | |
| 162 | - $projects->transform(function ($project, $key) { |
|
| 162 | + $projects->transform(function($project, $key) { |
|
| 163 | 163 | return $this->transformProject($project); |
| 164 | 164 | }); |
| 165 | 165 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | if ($project['TotalSites'] > 1) { |
| 184 | 184 | $transformedProject->sites = collect($project['Site']); |
| 185 | 185 | } |
| 186 | - $transformedProject->sites->transform(function ($site, $key) { |
|
| 186 | + $transformedProject->sites->transform(function($site, $key) { |
|
| 187 | 187 | return $this->transformSite($site); |
| 188 | 188 | }); |
| 189 | 189 | |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $transformedSite->created_at = $site['CreatedAt']; |
| 201 | 201 | |
| 202 | 202 | if (array_key_exists('Keyword', $site)) { |
| 203 | - $transformedSite->keywords = collect($site['Keyword'])->transform(function ($keyword, $key) { |
|
| 203 | + $transformedSite->keywords = collect($site['Keyword'])->transform(function($keyword, $key) { |
|
| 204 | 204 | return $this->transformKeyword($keyword); |
| 205 | 205 | }); |
| 206 | 206 | } |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | if (array_key_exists('Tag', $site)) { |
| 213 | - $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function ($tag, $key) { |
|
| 213 | + $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function($tag, $key) { |
|
| 214 | 214 | return $this->transformTag($tag); |
| 215 | 215 | }); |
| 216 | 216 | } |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | if (is_null($keyword['KeywordStats'])) { |
| 239 | 239 | $modifiedKeyword->keyword_stats = null; |
| 240 | 240 | } else { |
| 241 | - $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function ($searchVolume, $month) { |
|
| 241 | + $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function($searchVolume, $month) { |
|
| 242 | 242 | return new StatLocalSearchTrend([ |
| 243 | 243 | 'month' => strtolower($month), |
| 244 | 244 | 'search_volume' => ($searchVolume == '-') ? null : $searchVolume, |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | |
| 289 | 289 | $rankings = $this->getCollection($rankingForEngine['Result'], 'Rank'); |
| 290 | 290 | |
| 291 | - $rankings->transform(function ($ranking, $key) { |
|
| 291 | + $rankings->transform(function($ranking, $key) { |
|
| 292 | 292 | return $this->transformRanking($ranking); |
| 293 | 293 | }); |
| 294 | 294 | |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } while ($response['resultsreturned'] < $response['totalresults']); |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - $sites->transform(function ($site) { |
|
| 31 | + $sites->transform(function($site) { |
|
| 32 | 32 | return new StatSite([ |
| 33 | 33 | 'id' => $site['Id'], |
| 34 | 34 | 'project_id' => $site['ProjectId'], |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $sites = collect($response['Result']); |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - $sites->transform(function ($site) use ($projectID) { |
|
| 70 | + $sites->transform(function($site) use ($projectID) { |
|
| 71 | 71 | return new StatSite([ |
| 72 | 72 | 'id' => $site['Id'], |
| 73 | 73 | 'project_id' => $projectID, |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | $rankDistribution = collect([$response['RankDistribution']]); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $rankDistribution->transform(function ($distribution) { |
|
| 106 | + $rankDistribution->transform(function($distribution) { |
|
| 107 | 107 | return $this->transformRankDistribution($distribution); |
| 108 | 108 | }); |
| 109 | 109 | |
@@ -145,19 +145,19 @@ discard block |
||
| 145 | 145 | $arguments = []; |
| 146 | 146 | $arguments['id'] = $siteID; |
| 147 | 147 | |
| 148 | - if(!is_null($title)){ |
|
| 148 | + if (!is_null($title)) { |
|
| 149 | 149 | $arguments['title'] = rawurlencode($title); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if(!is_null($url)){ |
|
| 152 | + if (!is_null($url)) { |
|
| 153 | 153 | $arguments['url'] = rawurlencode($url); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if(!is_null($dropWWWprefix)){ |
|
| 156 | + if (!is_null($dropWWWprefix)) { |
|
| 157 | 157 | $arguments['drop_www_prefix'] = ($dropWWWprefix) ?: 0; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if(!is_null($dropDirectories)){ |
|
| 160 | + if (!is_null($dropDirectories)) { |
|
| 161 | 161 | $arguments['drop_directories'] = ($dropDirectories) ?: 0; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | $keywords = collect(); |
| 22 | 22 | |
| 23 | 23 | do { |
| 24 | - $response = $this->performQuery('keywords/list', ['site_id' => $siteID, 'start' => $start, 'results' => 5000 ]); |
|
| 24 | + $response = $this->performQuery('keywords/list', ['site_id' => $siteID, 'start' => $start, 'results' => 5000]); |
|
| 25 | 25 | $start += 5000; |
| 26 | 26 | |
| 27 | 27 | if ($response['totalresults'] == 0) { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } while ($response['resultsreturned'] < $response['totalresults']); |
| 41 | 41 | |
| 42 | 42 | |
| 43 | - $keywords = $keywords->transform(function ($keyword) { |
|
| 43 | + $keywords = $keywords->transform(function($keyword) { |
|
| 44 | 44 | return $this->transformListedKeyword($keyword); |
| 45 | 45 | }); |
| 46 | 46 | |
@@ -63,15 +63,15 @@ discard block |
||
| 63 | 63 | $arguments['device'] = $device; |
| 64 | 64 | $arguments['type'] = 'regular'; |
| 65 | 65 | |
| 66 | - $keywords = array_map(function ($keyword) { |
|
| 66 | + $keywords = array_map(function($keyword) { |
|
| 67 | 67 | $keyword = str_replace(',', '\,', $keyword); |
| 68 | 68 | $keyword = rawurlencode($keyword); |
| 69 | 69 | return $keyword; |
| 70 | 70 | }, $keywords); |
| 71 | 71 | $arguments['keyword'] = implode(',', $keywords); |
| 72 | 72 | |
| 73 | - if (! is_null($tags) && count($tags) > 0) { |
|
| 74 | - $tags = array_map(function ($tag) { |
|
| 73 | + if (!is_null($tags) && count($tags) > 0) { |
|
| 74 | + $tags = array_map(function($tag) { |
|
| 75 | 75 | $tag = str_replace(',', '-', $tag); |
| 76 | 76 | $tag = rawurlencode($tag); |
| 77 | 77 | return $tag; |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $arguments['tag'] = implode(',', $tags); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - if (! is_null($location) && $location != '') { |
|
| 83 | + if (!is_null($location) && $location != '') { |
|
| 84 | 84 | $arguments['location'] = $location; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $keywords = collect($response['Result']); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - return $keywords->transform(function ($keyword) { |
|
| 100 | + return $keywords->transform(function($keyword) { |
|
| 101 | 101 | return $this->transformCreatedKeyword($keyword); |
| 102 | 102 | }); |
| 103 | 103 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | |
| 124 | - return collect($response['Result'])->transform(function ($keywordID) { |
|
| 124 | + return collect($response['Result'])->transform(function($keywordID) { |
|
| 125 | 125 | return $keywordID['Id']; |
| 126 | 126 | }); |
| 127 | 127 | } |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | if (is_null($keyword['KeywordStats'])) { |
| 168 | 168 | $modifiedKeyword->keyword_stats = null; |
| 169 | 169 | } else { |
| 170 | - $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function ($searchVolume, $month) { |
|
| 170 | + $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function($searchVolume, $month) { |
|
| 171 | 171 | return new StatLocalSearchTrend([ |
| 172 | 172 | 'month' => strtolower($month), |
| 173 | 173 | 'search_volume' => ($searchVolume == '-') ? null : $searchVolume, |