Completed
Push — master ( 4ed653...39a76c )
by
unknown
02:20
created
src/authentication/SandboxStrategy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
      * AdnxStrategy constructor.
27 27
      *
28 28
      * @param ClientInterface $clientInterface
29
-     * @param Cache|null      $cache
29
+     * @param Cache      $cache
30 30
      */
31 31
     public function __construct(ClientInterface $clientInterface, Cache $cache)
32 32
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function authenticate($username, $password, $cache = true)
46 46
     {
47 47
 
48
-        $cacheKey = self::CACHE_NAMESPACE.sha1($username.$password.self::BASE_URL);
48
+        $cacheKey = self::CACHE_NAMESPACE . sha1($username . $password . self::BASE_URL);
49 49
 
50 50
         if ($cache) {
51 51
             if ($this->cache->contains($cacheKey)) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
         $contentArray = json_decode($content, true);
69 69
 
70
-        if (!isset($contentArray["response"]["token"])) {
70
+        if ( ! isset($contentArray["response"]["token"])) {
71 71
             throw new AuthException($content);
72 72
         }
73 73
 
Please login to merge, or discard this patch.
src/service/UserUpload.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
         $repositoryResponse = RepositoryResponse::fromResponse($response);
100 100
 
101
-        if (!$repositoryResponse->isSuccessful()) {
101
+        if ( ! $repositoryResponse->isSuccessful()) {
102 102
             throw UploadException::failed($repositoryResponse);
103 103
         }
104 104
 
@@ -115,17 +115,17 @@  discard block
 block discarded – undo
115 115
     public function getUploadTicket($memberId)
116 116
     {
117 117
 
118
-        $compiledUrl = $this->baseUrl.'?member_id='.$memberId;
118
+        $compiledUrl = $this->baseUrl . '?member_id=' . $memberId;
119 119
 
120 120
         $response = $this->client->request('POST', $compiledUrl);
121 121
 
122 122
         $repositoryResponse = RepositoryResponse::fromResponse($response);
123 123
 
124
-        if (!$repositoryResponse->isSuccessful()) {
124
+        if ( ! $repositoryResponse->isSuccessful()) {
125 125
             throw UploadException::failed($repositoryResponse);
126 126
         }
127 127
 
128
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'])) {
128
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'])) {
129 129
             throw UploadException::missingIndex('response->batch_segment_upload_job');
130 130
         }
131 131
 
@@ -146,17 +146,17 @@  discard block
 block discarded – undo
146 146
     public function getJobStatus(UploadTicket $uploadTicket)
147 147
     {
148 148
 
149
-        $compiledUrl = $this->baseUrl."?member_id={$uploadTicket->getMemberId()}&job_id={$uploadTicket->getJobId()}";
149
+        $compiledUrl = $this->baseUrl . "?member_id={$uploadTicket->getMemberId()}&job_id={$uploadTicket->getJobId()}";
150 150
 
151 151
         $response = $this->client->request('GET', $compiledUrl);
152 152
 
153 153
         $repositoryResponse = RepositoryResponse::fromResponse($response);
154 154
 
155
-        if (!$repositoryResponse->isSuccessful()) {
155
+        if ( ! $repositoryResponse->isSuccessful()) {
156 156
             throw UploadException::failed($repositoryResponse);
157 157
         }
158 158
 
159
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) {
159
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) {
160 160
             throw UploadException::missingIndex('response->batch_segment_upload_job->0');
161 161
         }
162 162
 
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
     public function getUploadHistory($memberId, $start = 0, $maxResults = 100)
180 180
     {
181 181
 
182
-        $compiledUrl = $this->baseUrl."?member_id=$memberId&start_element=$start&num_elements=$maxResults";
182
+        $compiledUrl = $this->baseUrl . "?member_id=$memberId&start_element=$start&num_elements=$maxResults";
183 183
 
184 184
         $response = $this->client->request('GET', $compiledUrl);
185 185
 
186 186
         $repositoryResponse = RepositoryResponse::fromResponse($response);
187 187
 
188
-        if (!$repositoryResponse->isSuccessful()) {
188
+        if ( ! $repositoryResponse->isSuccessful()) {
189 189
             throw UploadException::failed($repositoryResponse);
190 190
         }
191 191
 
192
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) {
192
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) {
193 193
             throw UploadException::missingIndex('response->batch_segment_upload_job->0');
194 194
         }
195 195
 
Please login to merge, or discard this patch.
src/repository/SegmentRepository.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     public function add(Segment $segment)
79 79
     {
80 80
 
81
-        $compiledUrl = $this->baseUrl.$segment->getMemberId();
81
+        $compiledUrl = $this->baseUrl . $segment->getMemberId();
82 82
 
83 83
         $payload = [
84 84
             'segment' => $segment->toArray(),
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
             $responseContent = json_decode($stream->getContents(), true);
94 94
             $stream->rewind();
95 95
 
96
-            if (!(isset($responseContent['response']['segment']['id']))) {
96
+            if ( ! (isset($responseContent['response']['segment']['id']))) {
97 97
                 throw RepositoryException::wrongFormat(serialize($responseContent));
98 98
             }
99 99
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     public function remove($memberId, $id)
114 114
     {
115 115
 
116
-        $compiledUrl = $this->baseUrl.$memberId.'/'.$id;
116
+        $compiledUrl = $this->baseUrl . $memberId . '/' . $id;
117 117
 
118 118
         $response = $this->client->request('DELETE', $compiledUrl);
119 119
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
     public function update(Segment $segment)
133 133
     {
134 134
 
135
-        if (!$segment->getId()) {
135
+        if ( ! $segment->getId()) {
136 136
             throw RepositoryException::missingId($segment);
137 137
         }
138 138
 
139
-        $compiledUrl = $this->baseUrl.$segment->getMemberId().'/'.$segment->getId();
139
+        $compiledUrl = $this->baseUrl . $segment->getMemberId() . '/' . $segment->getId();
140 140
 
141 141
         $payload = [
142 142
             'segment' => $segment->toArray(),
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
     public function findOneById($memberId, $id)
160 160
     {
161 161
 
162
-        $compiledUrl = $this->baseUrl.$memberId.'/'.$id;
162
+        $compiledUrl = $this->baseUrl . $memberId . '/' . $id;
163 163
 
164 164
         $response = $this->client->request('GET', $compiledUrl);
165 165
 
166 166
         $repositoryResponse = RepositoryResponse::fromResponse($response);
167 167
 
168
-        if (!$repositoryResponse->isSuccessful()) {
168
+        if ( ! $repositoryResponse->isSuccessful()) {
169 169
             return null;
170 170
         }
171 171
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function findAll($memberId, $start = 0, $maxResults = 100)
189 189
     {
190 190
 
191
-        $cacheKey = self::CACHE_NAMESPACE.sha1($memberId.$start.$maxResults);
191
+        $cacheKey = self::CACHE_NAMESPACE . sha1($memberId . $start . $maxResults);
192 192
 
193 193
         if ($this->isCacheEnabled()) {
194 194
             if ($this->cache->contains($cacheKey)) {
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
             }
197 197
         }
198 198
 
199
-        $compiledUrl = $this->baseUrl.$memberId."?start_element=$start&num_elements=$maxResults";
199
+        $compiledUrl = $this->baseUrl . $memberId . "?start_element=$start&num_elements=$maxResults";
200 200
 
201 201
         $response = $this->client->request('GET', $compiledUrl);
202 202
 
203 203
         $repositoryResponse = RepositoryResponse::fromResponse($response);
204 204
 
205
-        if (!$repositoryResponse->isSuccessful()) {
205
+        if ( ! $repositoryResponse->isSuccessful()) {
206 206
             throw RepositoryException::failed($repositoryResponse);
207 207
         }
208 208
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
         $result = [];
214 214
 
215
-        if (!$responseContent['response']['segments']) {
215
+        if ( ! $responseContent['response']['segments']) {
216 216
             $responseContent['response']['segments'] = [];
217 217
         }
218 218
 
Please login to merge, or discard this patch.
src/service/Report.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -185,11 +185,11 @@  discard block
 block discarded – undo
185 185
 
186 186
         $repositoryResponse = RepositoryResponse::fromResponse($response);
187 187
 
188
-        if (!$repositoryResponse->isSuccessful()) {
188
+        if ( ! $repositoryResponse->isSuccessful()) {
189 189
             throw ReportException::failed($repositoryResponse);
190 190
         }
191 191
 
192
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['report_id'])) {
192
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['report_id'])) {
193 193
             throw ReportException::missingIndex('response->report_id');
194 194
         }
195 195
 
@@ -217,15 +217,15 @@  discard block
 block discarded – undo
217 217
 
218 218
         $repositoryResponse = RepositoryResponse::fromResponse($response);
219 219
 
220
-        if (!$repositoryResponse->isSuccessful()) {
220
+        if ( ! $repositoryResponse->isSuccessful()) {
221 221
             throw ReportException::failed($repositoryResponse);
222 222
         }
223 223
 
224
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['report'])) {
224
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['report'])) {
225 225
             throw ReportException::missingIndex('response->report');
226 226
         }
227 227
 
228
-        if (!isset($repositoryResponse->getResponseAsArray()['response']['execution_status'])) {
228
+        if ( ! isset($repositoryResponse->getResponseAsArray()['response']['execution_status'])) {
229 229
             throw ReportException::missingIndex('response->execution_status');
230 230
         }
231 231
 
@@ -248,11 +248,11 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public function getReport(ReportStatus $reportStatus)
250 250
     {
251
-        if (!$reportStatus->isReady()) {
251
+        if ( ! $reportStatus->isReady()) {
252 252
             throw ReportException::validation('report status not ready');
253 253
         }
254 254
 
255
-        if (!$reportStatus->getUrl()) {
255
+        if ( ! $reportStatus->getUrl()) {
256 256
             throw ReportException::validation('missing url in the report status');
257 257
         }
258 258
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
         $lines = explode(PHP_EOL, $response->getBody()->getContents());
272 272
         $result = [];
273 273
         foreach ($lines as $line) {
274
-            if (!empty($line)) {
274
+            if ( ! empty($line)) {
275 275
                 $result[] = str_getcsv($line);
276 276
             }
277 277
         }
Please login to merge, or discard this patch.
src/repository/CategoryRepository.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
         $repositoryResponse = RepositoryResponse::fromResponse($response);
93 93
 
94
-        if (!$repositoryResponse->isSuccessful()) {
94
+        if ( ! $repositoryResponse->isSuccessful()) {
95 95
             throw RepositoryException::failed($repositoryResponse);
96 96
         }
97 97
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         $result = [];
103 103
 
104
-        if (!$responseContent['response']['content_categories']) {
104
+        if ( ! $responseContent['response']['content_categories']) {
105 105
             $responseContent['response']['content_categories'] = [];
106 106
         }
107 107
 
Please login to merge, or discard this patch.
src/exceptions/RepositoryException.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
      */
30 30
     public static function missingId($segment)
31 31
     {
32
-        return new self('Missing segment id for '.serialize($segment->getCode()));
32
+        return new self('Missing segment id for ' . serialize($segment->getCode()));
33 33
     }
34 34
 
35 35
     /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public static function missingSegmentBillingId($segment)
41 41
     {
42
-        return new self('Missing segment billing id for '.serialize($segment->getId()));
42
+        return new self('Missing segment billing id for ' . serialize($segment->getId()));
43 43
     }
44 44
 
45 45
     /**
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public static function failed(RepositoryResponse $repositoryResponse)
51 51
     {
52
-        return new self('Failed call: '.$repositoryResponse->getError()->getError());
52
+        return new self('Failed call: ' . $repositoryResponse->getError()->getError());
53 53
     }
54 54
 
55 55
     /**
@@ -69,6 +69,6 @@  discard block
 block discarded – undo
69 69
      */
70 70
     public static function missingIndex($missingIndex)
71 71
     {
72
-        return new self('Invalid reposnse missing: '. $missingIndex);
72
+        return new self('Invalid reposnse missing: ' . $missingIndex);
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
src/repository/SegmentBillingRepository.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     public function add(SegmentBilling $segmentBilling)
78 78
     {
79 79
 
80
-        $compiledUrl = $this->baseUrl.'?member_id='.$segmentBilling->getMemberId();
80
+        $compiledUrl = $this->baseUrl . '?member_id=' . $segmentBilling->getMemberId();
81 81
 
82 82
         $payload = [
83 83
             'segment-billing-category' => $segmentBilling->toArray(),
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $stream->rewind();
96 96
 
97 97
 
98
-            if (!(isset($responseContent['response']['segment-billing-category'][0]['id']))) {
98
+            if ( ! (isset($responseContent['response']['segment-billing-category'][0]['id']))) {
99 99
                 throw RepositoryException::wrongFormat(serialize($responseContent));
100 100
             }
101 101
 
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     public function update(SegmentBilling $segmentBilling)
115 115
     {
116 116
 
117
-        if (!$segmentBilling->getId()) {
117
+        if ( ! $segmentBilling->getId()) {
118 118
             throw RepositoryException::missingSegmentBillingId($segmentBilling);
119 119
         }
120 120
 
121
-        $compiledUrl = $this->baseUrl.'?member_id='.$segmentBilling->getMemberId();
121
+        $compiledUrl = $this->baseUrl . '?member_id=' . $segmentBilling->getMemberId();
122 122
 
123 123
         $payload = [
124 124
             'segment-billing-category' => $segmentBilling->toArray(),
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
     public function findOneBySegmentId($memberId, $segmentId)
141 141
     {
142 142
 
143
-        $compiledUrl = $this->baseUrl.'?member_id='.$memberId.'&segment_id='.$segmentId;
143
+        $compiledUrl = $this->baseUrl . '?member_id=' . $memberId . '&segment_id=' . $segmentId;
144 144
 
145 145
 
146 146
         $response = $this->client->request('GET', $compiledUrl);
147 147
 
148 148
         $repositoryResponse = RepositoryResponse::fromResponse($response);
149 149
 
150
-        if (!$repositoryResponse->isSuccessful()) {
150
+        if ( ! $repositoryResponse->isSuccessful()) {
151 151
             throw RepositoryException::failed($repositoryResponse);
152 152
         }
153 153
 
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
         $responseContent = json_decode($stream->getContents(), true);
156 156
         $stream->rewind();
157 157
 
158
-        if (!$responseContent['response']['segment-billing-categories']) {
158
+        if ( ! $responseContent['response']['segment-billing-categories']) {
159 159
             return null;
160 160
         }
161 161
 
162 162
         if (count($responseContent['response']['segment-billing-categories']) > 1) {
163
-            throw RepositoryException::genericFailed('Expected only one results. Found '.count($responseContent['response']['segment-billing-categories']));
163
+            throw RepositoryException::genericFailed('Expected only one results. Found ' . count($responseContent['response']['segment-billing-categories']));
164 164
         }
165 165
 
166 166
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     public function findAll($memberId, $start = 0, $maxResults = 100)
179 179
     {
180 180
 
181
-        $cacheKey = self::CACHE_NAMESPACE.sha1($memberId.$start.$maxResults);
181
+        $cacheKey = self::CACHE_NAMESPACE . sha1($memberId . $start . $maxResults);
182 182
 
183 183
 
184 184
         if ($this->isCacheEnabled()) {
@@ -187,14 +187,14 @@  discard block
 block discarded – undo
187 187
             }
188 188
         }
189 189
 
190
-        $compiledUrl = $this->baseUrl.'?member_id='.$memberId.'&start_element='.$start.'&num_elements='.$maxResults;
190
+        $compiledUrl = $this->baseUrl . '?member_id=' . $memberId . '&start_element=' . $start . '&num_elements=' . $maxResults;
191 191
 
192 192
 
193 193
         $response = $this->client->request('GET', $compiledUrl);
194 194
 
195 195
         $repositoryResponse = RepositoryResponse::fromResponse($response);
196 196
 
197
-        if (!$repositoryResponse->isSuccessful()) {
197
+        if ( ! $repositoryResponse->isSuccessful()) {
198 198
             throw RepositoryException::failed($repositoryResponse);
199 199
         }
200 200
 
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
         $result = [];
207 207
 
208
-        if (!$responseContent['response']['segment-billing-categories']) {
208
+        if ( ! $responseContent['response']['segment-billing-categories']) {
209 209
             $responseContent['response']['segment-billing-categories'] = [];
210 210
         }
211 211
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
     public function remove($memberId, $id)
230 230
     {
231 231
 
232
-        $compiledUrl = $this->baseUrl.'?member_id='.$memberId.'&id='.$id;
232
+        $compiledUrl = $this->baseUrl . '?member_id=' . $memberId . '&id=' . $id;
233 233
 
234 234
         $response = $this->client->request('DELETE', $compiledUrl);
235 235
 
Please login to merge, or discard this patch.