@@ -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'], |
@@ -15,7 +15,7 @@ |
||
15 | 15 | { |
16 | 16 | $response = $this->performQuery('projects/list'); |
17 | 17 | |
18 | - $projects = collect($response['Result'])->map(function ($project) { |
|
18 | + $projects = collect($response['Result'])->map(function($project) { |
|
19 | 19 | return new StatProject([ |
20 | 20 | 'id' => $project['Id'], |
21 | 21 | 'name' => $project['Name'], |
@@ -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 | return new StatSerpItem([ |
24 | 24 | 'result_type' => $ranking['ResultType'], |
25 | 25 | 'rank' => $ranking['Rank'], |
@@ -3,16 +3,16 @@ |
||
3 | 3 | namespace SchulzeFelix\Stat\Api; |
4 | 4 | |
5 | 5 | use Carbon\Carbon; |
6 | -use SchulzeFelix\Stat\Objects\StatTag; |
|
7 | -use SchulzeFelix\Stat\Objects\StatSite; |
|
6 | +use SchulzeFelix\Stat\Exceptions\ApiException; |
|
8 | 7 | use SchulzeFelix\Stat\Objects\StatBulkJob; |
9 | 8 | use SchulzeFelix\Stat\Objects\StatKeyword; |
10 | -use SchulzeFelix\Stat\Objects\StatProject; |
|
11 | -use SchulzeFelix\Stat\Exceptions\ApiException; |
|
12 | -use SchulzeFelix\Stat\Objects\StatKeywordStats; |
|
9 | +use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking; |
|
13 | 10 | use SchulzeFelix\Stat\Objects\StatKeywordRanking; |
11 | +use SchulzeFelix\Stat\Objects\StatKeywordStats; |
|
14 | 12 | use SchulzeFelix\Stat\Objects\StatLocalSearchTrend; |
15 | -use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking; |
|
13 | +use SchulzeFelix\Stat\Objects\StatProject; |
|
14 | +use SchulzeFelix\Stat\Objects\StatSite; |
|
15 | +use SchulzeFelix\Stat\Objects\StatTag; |
|
16 | 16 | |
17 | 17 | class StatBulk extends BaseStat |
18 | 18 | { |
@@ -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 $this->transformBulkJobStatus($job); |
39 | 39 | }); |
40 | 40 | } |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | $arguments['currently_tracked_only'] = $currentlyTrackedOnly; |
60 | 60 | $arguments['crawled_keywords_only'] = $crawledKeywordsOnly; |
61 | 61 | |
62 | - if (! is_null($sites) && count($sites) > 0) { |
|
62 | + if (!is_null($sites) && count($sites) > 0) { |
|
63 | 63 | $arguments['site_id'] = implode(',', $sites); |
64 | 64 | } |
65 | - if (! is_null($engines) && count($engines) > 0) { |
|
65 | + if (!is_null($engines) && count($engines) > 0) { |
|
66 | 66 | $arguments['engines'] = implode(',', $engines); |
67 | 67 | } |
68 | 68 | $response = $this->performQuery('bulk/ranks', $arguments); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $bulkStatus = $this->status($bulkJobID); |
108 | 108 | |
109 | 109 | if ($bulkStatus['status'] != 'Completed') { |
110 | - throw ApiException::resultError('Bulk Job is not completed. Current status: '.$bulkJobID['status'].'.'); |
|
110 | + throw ApiException::resultError('Bulk Job is not completed. Current status: ' . $bulkJobID['status'] . '.'); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $bulkStream = $this->statClient->downloadBulkJobStream($bulkStatus['stream_url']); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $projects = $this->getCollection($bulkStream['Project']); |
132 | 132 | |
133 | - $projects->transform(function ($project, $key) { |
|
133 | + $projects->transform(function($project, $key) { |
|
134 | 134 | return $this->transformProject($project); |
135 | 135 | }); |
136 | 136 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if ($project['TotalSites'] > 1) { |
155 | 155 | $transformedProject->sites = collect($project['Site']); |
156 | 156 | } |
157 | - $transformedProject->sites->transform(function ($site, $key) { |
|
157 | + $transformedProject->sites->transform(function($site, $key) { |
|
158 | 158 | return $this->transformSite($site); |
159 | 159 | }); |
160 | 160 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $transformedSite->created_at = $site['CreatedAt']; |
171 | 171 | |
172 | 172 | if (array_key_exists('Keyword', $site)) { |
173 | - $transformedSite->keywords = collect($site['Keyword'])->transform(function ($keyword, $key) { |
|
173 | + $transformedSite->keywords = collect($site['Keyword'])->transform(function($keyword, $key) { |
|
174 | 174 | return $this->transformKeyword($keyword); |
175 | 175 | }); |
176 | 176 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if (array_key_exists('Tag', $site)) { |
183 | - $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function ($tag, $key) { |
|
183 | + $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function($tag, $key) { |
|
184 | 184 | return $this->transformTag($tag); |
185 | 185 | }); |
186 | 186 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | if (is_null($keyword['KeywordStats'])) { |
208 | 208 | $modifiedKeyword->keyword_stats = null; |
209 | 209 | } else { |
210 | - $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function ($searchVolume, $month) { |
|
210 | + $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function($searchVolume, $month) { |
|
211 | 211 | return new StatLocalSearchTrend([ |
212 | 212 | 'month' => strtolower($month), |
213 | 213 | 'search_volume' => ($searchVolume == '-') ? null : $searchVolume, |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | $rankings = $this->getCollection($rankingForEngine['Result'], 'Rank'); |
255 | 255 | |
256 | - $rankings->transform(function ($ranking, $key) { |
|
256 | + $rankings->transform(function($ranking, $key) { |
|
257 | 257 | return $this->transformRanking($ranking); |
258 | 258 | }); |
259 | 259 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | $bulkJob->sites = collect(); |
307 | 307 | if (array_has($job, 'SiteId')) { |
308 | 308 | $bulkJob->sites = collect(explode(',', $job['SiteId'])) |
309 | - ->transform(function ($site, $key) { |
|
309 | + ->transform(function($site, $key) { |
|
310 | 310 | return (int) $site; |
311 | 311 | }); |
312 | 312 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | use Illuminate\Support\Collection; |
6 | 6 | use SchulzeFelix\Stat\Objects\StatKeyword; |
7 | -use SchulzeFelix\Stat\Objects\StatKeywordStats; |
|
7 | +use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking; |
|
8 | 8 | use SchulzeFelix\Stat\Objects\StatKeywordRanking; |
9 | +use SchulzeFelix\Stat\Objects\StatKeywordStats; |
|
9 | 10 | use SchulzeFelix\Stat\Objects\StatLocalSearchTrend; |
10 | -use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking; |
|
11 | 11 | |
12 | 12 | class StatKeywords extends BaseStat |
13 | 13 | { |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | |
36 | 36 | $keywords = $keywords->merge($response['Result']); |
37 | 37 | |
38 | - if (! isset($response['nextpage'])) { |
|
38 | + if (!isset($response['nextpage'])) { |
|
39 | 39 | break; |
40 | 40 | } |
41 | 41 | } while ($response['resultsreturned'] < $response['totalresults']); |
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,7 +63,7 @@ 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 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | }, $keywords); |
72 | 72 | $arguments['keyword'] = implode(',', $keywords); |
73 | 73 | |
74 | - if (! is_null($tags) && count($tags) > 0) { |
|
75 | - $tags = array_map(function ($tag) { |
|
74 | + if (!is_null($tags) && count($tags) > 0) { |
|
75 | + $tags = array_map(function($tag) { |
|
76 | 76 | $tag = str_replace(',', '-', $tag); |
77 | 77 | $tag = rawurlencode($tag); |
78 | 78 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $arguments['tag'] = implode(',', $tags); |
83 | 83 | } |
84 | 84 | |
85 | - if (! is_null($location) && $location != '') { |
|
85 | + if (!is_null($location) && $location != '') { |
|
86 | 86 | $arguments['location'] = $location; |
87 | 87 | } |
88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $keywords = collect($response['Result']); |
100 | 100 | } |
101 | 101 | |
102 | - return $keywords->transform(function ($keyword) { |
|
102 | + return $keywords->transform(function($keyword) { |
|
103 | 103 | return $this->transformCreatedKeyword($keyword); |
104 | 104 | }); |
105 | 105 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function delete($id) |
112 | 112 | { |
113 | - if (! is_array($id)) { |
|
113 | + if (!is_array($id)) { |
|
114 | 114 | $id = [$id]; |
115 | 115 | } |
116 | 116 | |
117 | - if (! array_filter($id)) { |
|
117 | + if (!array_filter($id)) { |
|
118 | 118 | return new Collection(); |
119 | 119 | } |
120 | 120 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return collect($response['Result']['Id']); |
127 | 127 | } |
128 | 128 | |
129 | - return collect($response['Result'])->transform(function ($keywordID) { |
|
129 | + return collect($response['Result'])->transform(function($keywordID) { |
|
130 | 130 | return $keywordID['Id']; |
131 | 131 | }); |
132 | 132 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | if (is_null($keyword['KeywordStats'])) { |
170 | 170 | $modifiedKeyword->keyword_stats = null; |
171 | 171 | } else { |
172 | - $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function ($searchVolume, $month) { |
|
172 | + $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function($searchVolume, $month) { |
|
173 | 173 | return new StatLocalSearchTrend([ |
174 | 174 | 'month' => strtolower($month), |
175 | 175 | 'search_volume' => ($searchVolume == '-') ? null : $searchVolume, |
@@ -4,8 +4,8 @@ |
||
4 | 4 | |
5 | 5 | use Carbon\Carbon; |
6 | 6 | use Illuminate\Support\Collection; |
7 | -use SchulzeFelix\Stat\Objects\StatKeywordRanking; |
|
8 | 7 | use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking; |
8 | +use SchulzeFelix\Stat\Objects\StatKeywordRanking; |
|
9 | 9 | |
10 | 10 | class StatRankings extends BaseStat |
11 | 11 | { |
@@ -30,12 +30,12 @@ |
||
30 | 30 | $rankings = $rankings->merge($response['Result']); |
31 | 31 | } |
32 | 32 | |
33 | - if (! isset($response['nextpage'])) { |
|
33 | + if (!isset($response['nextpage'])) { |
|
34 | 34 | break; |
35 | 35 | } |
36 | 36 | } while ($response['resultsreturned'] < $response['totalresults']); |
37 | 37 | |
38 | - $rankings = $rankings->transform(function ($ranking, $key) { |
|
38 | + $rankings = $rankings->transform(function($ranking, $key) { |
|
39 | 39 | return new StatKeywordRanking([ |
40 | 40 | 'date' => $ranking['date'], |
41 | 41 | 'google' => new StatKeywordEngineRanking([ |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | use Carbon\Carbon; |
6 | 6 | use Illuminate\Support\Collection; |
7 | -use SchulzeFelix\Stat\Objects\StatTag; |
|
8 | -use SchulzeFelix\Stat\Objects\StatShareOfVoice; |
|
9 | 7 | use SchulzeFelix\Stat\Objects\StatFrequentDomain; |
8 | +use SchulzeFelix\Stat\Objects\StatShareOfVoice; |
|
10 | 9 | use SchulzeFelix\Stat\Objects\StatShareOfVoiceSite; |
10 | +use SchulzeFelix\Stat\Objects\StatTag; |
|
11 | 11 | |
12 | 12 | class StatTags extends BaseStat |
13 | 13 | { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $tags = collect($response['Result']); |
34 | 34 | } |
35 | 35 | |
36 | - $tags = $tags->transform(function ($item, $key) { |
|
36 | + $tags = $tags->transform(function($item, $key) { |
|
37 | 37 | if ($item['Keywords'] == 'none') { |
38 | 38 | $item['Keywords'] = collect(); |
39 | 39 | } else { |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $rankDistribution = collect([$response['RankDistribution']]); |
70 | 70 | } |
71 | 71 | |
72 | - $rankDistribution->transform(function ($distribution, $key) { |
|
72 | + $rankDistribution->transform(function($distribution, $key) { |
|
73 | 73 | return $this->transformRankDistribution($distribution); |
74 | 74 | }); |
75 | 75 | |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | $start += 5000; |
93 | 93 | $sovSites = $sovSites->merge($response['ShareOfVoice']); |
94 | 94 | |
95 | - if (! isset($response['nextpage'])) { |
|
95 | + if (!isset($response['nextpage'])) { |
|
96 | 96 | break; |
97 | 97 | } |
98 | 98 | } while ($response['resultsreturned'] < $response['totalresults']); |
99 | 99 | |
100 | - $sovSites->transform(function ($sov) { |
|
100 | + $sovSites->transform(function($sov) { |
|
101 | 101 | $shareOfVoice = new StatShareOfVoice([ |
102 | 102 | 'date' => $sov['date'], |
103 | - 'sites' => collect($sov['Site'])->transform(function ($site) { |
|
103 | + 'sites' => collect($sov['Site'])->transform(function($site) { |
|
104 | 104 | return new StatShareOfVoiceSite([ |
105 | 105 | 'domain' => $site['Domain'], |
106 | 106 | 'share' => (float) $site['Share'], |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | { |
125 | 125 | $response = $this->performQuery('tags/most_frequent_domains', ['id' => $tagID, 'engine' => $engine]); |
126 | 126 | |
127 | - $domains = collect($response['Site'])->transform(function ($site) { |
|
127 | + $domains = collect($response['Site'])->transform(function($site) { |
|
128 | 128 | return new StatFrequentDomain([ |
129 | 129 | 'domain' => array_get($site, 'Domain'), |
130 | 130 | 'top_ten_results' => array_get($site, 'TopTenResults'), |
@@ -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,11 +26,11 @@ 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 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | return StatClientFactory::createForConfig($statConfig); |
39 | 39 | }); |
40 | 40 | |
41 | - $this->app->bind(Stat::class, function () { |
|
41 | + $this->app->bind(Stat::class, function() { |
|
42 | 42 | $client = app(StatClient::class); |
43 | 43 | |
44 | 44 | return new Stat($client); |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | $start += 5000; |
25 | 25 | $sites = $sites->merge($response['Result']); |
26 | 26 | |
27 | - if (! isset($response['nextpage'])) { |
|
27 | + if (!isset($response['nextpage'])) { |
|
28 | 28 | break; |
29 | 29 | } |
30 | 30 | } while ($response['resultsreturned'] < $response['totalresults']); |
31 | 31 | |
32 | - $sites->transform(function ($site) { |
|
32 | + $sites->transform(function($site) { |
|
33 | 33 | return new StatSite([ |
34 | 34 | 'id' => $site['Id'], |
35 | 35 | 'project_id' => $site['ProjectId'], |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $sites = collect($response['Result']); |
69 | 69 | } |
70 | 70 | |
71 | - $sites->transform(function ($site) use ($projectID) { |
|
71 | + $sites->transform(function($site) use ($projectID) { |
|
72 | 72 | return new StatSite([ |
73 | 73 | 'id' => $site['Id'], |
74 | 74 | 'project_id' => $projectID, |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $rankDistribution = collect([$response['RankDistribution']]); |
105 | 105 | } |
106 | 106 | |
107 | - $rankDistribution->transform(function ($distribution) { |
|
107 | + $rankDistribution->transform(function($distribution) { |
|
108 | 108 | return $this->transformRankDistribution($distribution); |
109 | 109 | }); |
110 | 110 | |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | $arguments = []; |
147 | 147 | $arguments['id'] = $siteID; |
148 | 148 | |
149 | - if (! is_null($title)) { |
|
149 | + if (!is_null($title)) { |
|
150 | 150 | $arguments['title'] = rawurlencode($title); |
151 | 151 | } |
152 | 152 | |
153 | - if (! is_null($url)) { |
|
153 | + if (!is_null($url)) { |
|
154 | 154 | $arguments['url'] = rawurlencode($url); |
155 | 155 | } |
156 | 156 | |
157 | - if (! is_null($dropWWWprefix)) { |
|
157 | + if (!is_null($dropWWWprefix)) { |
|
158 | 158 | $arguments['drop_www_prefix'] = ($dropWWWprefix) ?: 0; |
159 | 159 | } |
160 | 160 | |
161 | - if (! is_null($dropDirectories)) { |
|
161 | + if (!is_null($dropDirectories)) { |
|
162 | 162 | $arguments['drop_directories'] = ($dropDirectories) ?: 0; |
163 | 163 | } |
164 | 164 | |
@@ -203,15 +203,15 @@ discard block |
||
203 | 203 | $start += 5000; |
204 | 204 | $sovSites = $sovSites->merge($response['ShareOfVoice']); |
205 | 205 | |
206 | - if (! isset($response['nextpage'])) { |
|
206 | + if (!isset($response['nextpage'])) { |
|
207 | 207 | break; |
208 | 208 | } |
209 | 209 | } while ($response['resultsreturned'] < $response['totalresults']); |
210 | 210 | |
211 | - $sovSites->transform(function ($sov) { |
|
211 | + $sovSites->transform(function($sov) { |
|
212 | 212 | $shareOfVoice = new StatShareOfVoice([ |
213 | 213 | 'date' => $sov['date'], |
214 | - 'sites' => collect($sov['Site'])->transform(function ($site) { |
|
214 | + 'sites' => collect($sov['Site'])->transform(function($site) { |
|
215 | 215 | return new StatShareOfVoiceSite([ |
216 | 216 | 'domain' => $site['Domain'], |
217 | 217 | 'share' => (float) $site['Share'], |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $response = $this->performQuery('sites/most_frequent_domains', ['id' => $siteID, 'engine' => $engine]); |
237 | 237 | |
238 | - $domains = collect($response['Site'])->transform(function ($site) { |
|
238 | + $domains = collect($response['Site'])->transform(function($site) { |
|
239 | 239 | return new StatFrequentDomain([ |
240 | 240 | 'domain' => array_get($site, 'Domain'), |
241 | 241 | 'top_ten_results' => array_get($site, 'TopTenResults'), |