Test Setup Failed
Push — master ( cdda4e...30598c )
by Felix
07:50
created
src/Api/StatSubAccounts.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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'],
Please login to merge, or discard this patch.
src/Api/StatSerps.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
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'],
Please login to merge, or discard this patch.
src/Api/StatKeywords.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
src/Api/StatRankings.php 2 patches
Unused Use Statements   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@
 block discarded – undo
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([
Please login to merge, or discard this patch.
src/StatServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/StatClient.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@
 block discarded – undo
40 40
         $parameterString = '?format=json';
41 41
 
42 42
         foreach ($parameters as $parameter => $value) {
43
-            $parameterString .= '&'.$parameter.'='.$value;
43
+            $parameterString .= '&' . $parameter . '=' . $value;
44 44
         }
45 45
 
46
-        $request = $method.$parameterString;
46
+        $request = $method . $parameterString;
47 47
 
48 48
         return $request;
49 49
     }
Please login to merge, or discard this patch.
src/Api/BaseStat.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $backoff = new ExponentialBackoff(5);
40 40
 
41 41
         try {
42
-            $response = $backoff->execute(function () use ($method, $parameters) {
42
+            $response = $backoff->execute(function() use ($method, $parameters) {
43 43
                 return $this->statClient->performQuery($method, $parameters);
44 44
             });
45 45
         } catch (ClientException $e) {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     protected function checkMaximumDateRange(Carbon $fromDate, Carbon $toDate, $maxDays = 31)
64 64
     {
65 65
         if ($fromDate->diffInDays($toDate) > $maxDays) {
66
-            throw ApiException::resultError('The maximum date range between from_date and to_date is '.$maxDays.' days.');
66
+            throw ApiException::resultError('The maximum date range between from_date and to_date is ' . $maxDays . ' days.');
67 67
         }
68 68
     }
69 69
 
Please login to merge, or discard this patch.
src/ExponentialBackoff.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $this->retries = $retries !== null ? (int) $retries : 3;
34 34
         $this->retryFunction = $retryFunction;
35
-        $this->delayFunction = function ($delay) {
35
+        $this->delayFunction = function($delay) {
36 36
             usleep($delay);
37 37
         };
38 38
     }
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
                 return call_user_func_array($function, $arguments);
57 57
             } catch (\Exception $exception) {
58 58
                 if ($this->retryFunction) {
59
-                    if (! call_user_func($this->retryFunction, $exception)) {
59
+                    if (!call_user_func($this->retryFunction, $exception)) {
60 60
                         throw $exception;
61 61
                     }
62 62
                 }
Please login to merge, or discard this patch.
src/Api/StatBulk.php 2 patches
Unused Use Statements   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,16 +4,16 @@
 block discarded – undo
4 4
 
5 5
 use Carbon\Carbon;
6 6
 use Illuminate\Support\Arr;
7
-use SchulzeFelix\Stat\Objects\StatTag;
8
-use SchulzeFelix\Stat\Objects\StatSite;
7
+use SchulzeFelix\Stat\Exceptions\ApiException;
9 8
 use SchulzeFelix\Stat\Objects\StatBulkJob;
10 9
 use SchulzeFelix\Stat\Objects\StatKeyword;
11
-use SchulzeFelix\Stat\Objects\StatProject;
12
-use SchulzeFelix\Stat\Exceptions\ApiException;
13
-use SchulzeFelix\Stat\Objects\StatKeywordStats;
10
+use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking;
14 11
 use SchulzeFelix\Stat\Objects\StatKeywordRanking;
12
+use SchulzeFelix\Stat\Objects\StatKeywordStats;
15 13
 use SchulzeFelix\Stat\Objects\StatLocalSearchTrend;
16
-use SchulzeFelix\Stat\Objects\StatKeywordEngineRanking;
14
+use SchulzeFelix\Stat\Objects\StatProject;
15
+use SchulzeFelix\Stat\Objects\StatSite;
16
+use SchulzeFelix\Stat\Objects\StatTag;
17 17
 
18 18
 class StatBulk extends BaseStat
19 19
 {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             $bulkJobs = collect($response['Result']);
36 36
         }
37 37
 
38
-        return $bulkJobs->transform(function ($job, $key) {
38
+        return $bulkJobs->transform(function($job, $key) {
39 39
             return $this->transformBulkJobStatus($job);
40 40
         });
41 41
     }
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
         $arguments['currently_tracked_only'] = $currentlyTrackedOnly;
61 61
         $arguments['crawled_keywords_only'] = $crawledKeywordsOnly;
62 62
 
63
-        if (! is_null($sites) && count($sites) > 0) {
63
+        if (!is_null($sites) && count($sites) > 0) {
64 64
             $arguments['site_id'] = implode(',', $sites);
65 65
         }
66
-        if (! is_null($engines) && count($engines) > 0) {
66
+        if (!is_null($engines) && count($engines) > 0) {
67 67
             $arguments['engines'] = implode(',', $engines);
68 68
         }
69 69
         $response = $this->performQuery('bulk/ranks', $arguments);
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $bulkStatus = $this->status($bulkJobID);
109 109
 
110 110
         if ($bulkStatus['status'] != 'Completed') {
111
-            throw ApiException::resultError('Bulk Job is not completed. Current status: '.$bulkJobID['status'].'.');
111
+            throw ApiException::resultError('Bulk Job is not completed. Current status: ' . $bulkJobID['status'] . '.');
112 112
         }
113 113
 
114 114
         $bulkStream = $this->statClient->downloadBulkJobStream($bulkStatus['stream_url']);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     {
132 132
         $projects = $this->getCollection($bulkStream['Project']);
133 133
 
134
-        $projects->transform(function ($project, $key) {
134
+        $projects->transform(function($project, $key) {
135 135
             return $this->transformProject($project);
136 136
         });
137 137
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         if ($project['TotalSites'] > 1) {
156 156
             $transformedProject->sites = collect($project['Site']);
157 157
         }
158
-        $transformedProject->sites->transform(function ($site, $key) {
158
+        $transformedProject->sites->transform(function($site, $key) {
159 159
             return $this->transformSite($site);
160 160
         });
161 161
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $transformedSite->created_at = $site['CreatedAt'];
172 172
 
173 173
         if (array_key_exists('Keyword', $site)) {
174
-            $transformedSite->keywords = collect($site['Keyword'])->transform(function ($keyword, $key) {
174
+            $transformedSite->keywords = collect($site['Keyword'])->transform(function($keyword, $key) {
175 175
                 return $this->transformKeyword($keyword);
176 176
             });
177 177
         }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
 
183 183
         if (array_key_exists('Tag', $site)) {
184
-            $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function ($tag, $key) {
184
+            $transformedSite->tags = $this->getCollection($site['Tag'])->transform(function($tag, $key) {
185 185
                 return $this->transformTag($tag);
186 186
             });
187 187
         }
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
         if (is_null($keyword['KeywordStats'])) {
209 209
             $modifiedKeyword->keyword_stats = null;
210 210
         } else {
211
-            $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function ($searchVolume, $month) {
211
+            $localTrends = collect($keyword['KeywordStats']['LocalSearchTrendsByMonth'])->map(function($searchVolume, $month) {
212 212
                 return new StatLocalSearchTrend([
213 213
                     'month' => strtolower($month),
214 214
                     'search_volume' => ($searchVolume == '-') ? null : $searchVolume,
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 
255 255
         $rankings = $this->getCollection($rankingForEngine['Result'], 'Rank');
256 256
 
257
-        $rankings->transform(function ($ranking, $key) {
257
+        $rankings->transform(function($ranking, $key) {
258 258
             return $this->transformRanking($ranking);
259 259
         });
260 260
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $bulkJob->sites = collect();
308 308
         if (Arr::has($job, 'SiteId')) {
309 309
             $bulkJob->sites = collect(explode(',', $job['SiteId']))
310
-                ->transform(function ($site, $key) {
310
+                ->transform(function($site, $key) {
311 311
                     return (int) $site;
312 312
                 });
313 313
         }
Please login to merge, or discard this patch.