Test Setup Failed
Pull Request — master (#15)
by Felix
05:21 queued 03:30
created
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.
src/Api/StatTags.php 2 patches
Unused Use Statements   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,10 +5,10 @@
 block discarded – undo
5 5
 use Carbon\Carbon;
6 6
 use Illuminate\Support\Arr;
7 7
 use Illuminate\Support\Collection;
8
-use SchulzeFelix\Stat\Objects\StatTag;
9
-use SchulzeFelix\Stat\Objects\StatShareOfVoice;
10 8
 use SchulzeFelix\Stat\Objects\StatFrequentDomain;
9
+use SchulzeFelix\Stat\Objects\StatShareOfVoice;
11 10
 use SchulzeFelix\Stat\Objects\StatShareOfVoiceSite;
11
+use SchulzeFelix\Stat\Objects\StatTag;
12 12
 
13 13
 class StatTags extends BaseStat
14 14
 {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
             $tags = collect($response['Result']);
35 35
         }
36 36
 
37
-        $tags = $tags->transform(function ($item, $key) {
37
+        $tags = $tags->transform(function($item, $key) {
38 38
             if ($item['Keywords'] == 'none') {
39 39
                 $item['Keywords'] = collect();
40 40
             } else {
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             $rankDistribution = collect([$response['RankDistribution']]);
71 71
         }
72 72
 
73
-        $rankDistribution->transform(function ($distribution, $key) {
73
+        $rankDistribution->transform(function($distribution, $key) {
74 74
             return $this->transformRankDistribution($distribution);
75 75
         });
76 76
 
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
             $start += 5000;
94 94
             $sovSites = $sovSites->merge($response['ShareOfVoice']);
95 95
 
96
-            if (! isset($response['nextpage'])) {
96
+            if (!isset($response['nextpage'])) {
97 97
                 break;
98 98
             }
99 99
         } while ($response['resultsreturned'] < $response['totalresults']);
100 100
 
101
-        $sovSites->transform(function ($sov) {
101
+        $sovSites->transform(function($sov) {
102 102
             $shareOfVoice = new StatShareOfVoice([
103 103
                 'date' => $sov['date'],
104
-                'sites' => collect($sov['Site'])->transform(function ($site) {
104
+                'sites' => collect($sov['Site'])->transform(function($site) {
105 105
                     return new StatShareOfVoiceSite([
106 106
                         'domain' => $site['Domain'],
107 107
                         'share' => (float) $site['Share'],
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     {
126 126
         $response = $this->performQuery('tags/most_frequent_domains', ['id' => $tagID, 'engine' => $engine]);
127 127
 
128
-        $domains = collect($response['Site'])->transform(function ($site) {
128
+        $domains = collect($response['Site'])->transform(function($site) {
129 129
             return new StatFrequentDomain([
130 130
                 'domain'           => Arr::get($site, 'Domain'),
131 131
                 'top_ten_results'  => Arr::get($site, 'TopTenResults'),
Please login to merge, or discard this patch.
src/Api/StatProjects.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
             $response['Result'] = [$response['Result']];
19 19
         }
20 20
 
21
-        $projects = collect($response['Result'])->map(function ($project) {
21
+        $projects = collect($response['Result'])->map(function($project) {
22 22
             return new StatProject([
23 23
                 'id' => $project['Id'],
24 24
                 'name' => $project['Name'],
Please login to merge, or discard this patch.
src/Api/StatSites.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 
31 31
             $sites = $sites->merge($response['Result']);
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
-        $sites->transform(function ($site) {
38
+        $sites->transform(function($site) {
39 39
             return new StatSite([
40 40
                 'id' => $site['Id'],
41 41
                 'project_id' => $site['ProjectId'],
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             $sites = collect($response['Result']);
75 75
         }
76 76
 
77
-        $sites->transform(function ($site) use ($projectID) {
77
+        $sites->transform(function($site) use ($projectID) {
78 78
             return new StatSite([
79 79
                 'id' => $site['Id'],
80 80
                 'project_id' => $projectID,
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             $rankDistribution = collect([$response['RankDistribution']]);
111 111
         }
112 112
 
113
-        $rankDistribution->transform(function ($distribution) {
113
+        $rankDistribution->transform(function($distribution) {
114 114
             return $this->transformRankDistribution($distribution);
115 115
         });
116 116
 
@@ -152,19 +152,19 @@  discard block
 block discarded – undo
152 152
         $arguments = [];
153 153
         $arguments['id'] = $siteID;
154 154
 
155
-        if (! is_null($title)) {
155
+        if (!is_null($title)) {
156 156
             $arguments['title'] = rawurlencode($title);
157 157
         }
158 158
 
159
-        if (! is_null($url)) {
159
+        if (!is_null($url)) {
160 160
             $arguments['url'] = rawurlencode($url);
161 161
         }
162 162
 
163
-        if (! is_null($dropWWWprefix)) {
163
+        if (!is_null($dropWWWprefix)) {
164 164
             $arguments['drop_www_prefix'] = ($dropWWWprefix) ?: 0;
165 165
         }
166 166
 
167
-        if (! is_null($dropDirectories)) {
167
+        if (!is_null($dropDirectories)) {
168 168
             $arguments['drop_directories'] = ($dropDirectories) ?: 0;
169 169
         }
170 170
 
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
             $start += 5000;
210 210
             $sovSites = $sovSites->merge($response['ShareOfVoice']);
211 211
 
212
-            if (! isset($response['nextpage'])) {
212
+            if (!isset($response['nextpage'])) {
213 213
                 break;
214 214
             }
215 215
         } while ($response['resultsreturned'] < $response['totalresults']);
216 216
 
217
-        $sovSites->transform(function ($sov) {
217
+        $sovSites->transform(function($sov) {
218 218
             $shareOfVoice = new StatShareOfVoice([
219 219
                 'date' => $sov['date'],
220
-                'sites' => collect($sov['Site'])->transform(function ($site) {
220
+                'sites' => collect($sov['Site'])->transform(function($site) {
221 221
                     return new StatShareOfVoiceSite([
222 222
                         'domain' => $site['Domain'],
223 223
                         'share' => (float) $site['Share'],
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $response = $this->performQuery('sites/most_frequent_domains', ['id' => $siteID, 'engine' => $engine]);
243 243
 
244
-        $domains = collect($response['Site'])->transform(function ($site) {
244
+        $domains = collect($response['Site'])->transform(function($site) {
245 245
             return new StatFrequentDomain([
246 246
                 'domain'           => Arr::get($site, 'Domain'),
247 247
                 'top_ten_results'  => Arr::get($site, 'TopTenResults'),
Please login to merge, or discard this patch.