@@ -26,7 +26,7 @@ |
||
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 | { |
@@ -45,7 +45,7 @@ discard block |
||
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 |
||
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 |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | |
139 | 139 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
140 | 140 | |
141 | - if (!$repositoryResponse->isSuccessful()) { |
|
141 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
142 | 142 | throw ReportException::failed($repositoryResponse); |
143 | 143 | } |
144 | 144 | |
145 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['report_id'])) { |
|
145 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['report_id'])) { |
|
146 | 146 | throw ReportException::missingIndex('response->report_id'); |
147 | 147 | } |
148 | 148 | |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | public function getReportStatus(ReportTicket $reportTicket) |
165 | 165 | { |
166 | 166 | |
167 | - $compiledUrl = $this->baseUrl.'?id='.$reportTicket->getReportId(); |
|
167 | + $compiledUrl = $this->baseUrl . '?id=' . $reportTicket->getReportId(); |
|
168 | 168 | |
169 | 169 | $response = $this->client->request('GET', $compiledUrl); |
170 | 170 | |
171 | 171 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
172 | 172 | |
173 | - if (!$repositoryResponse->isSuccessful()) { |
|
173 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
174 | 174 | throw ReportException::failed($repositoryResponse); |
175 | 175 | } |
176 | 176 | |
177 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['report'])) { |
|
177 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['report'])) { |
|
178 | 178 | throw ReportException::missingIndex('response->report'); |
179 | 179 | } |
180 | 180 | |
181 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['execution_status'])) { |
|
181 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['execution_status'])) { |
|
182 | 182 | throw ReportException::missingIndex('response->execution_status'); |
183 | 183 | } |
184 | 184 | |
@@ -201,15 +201,15 @@ discard block |
||
201 | 201 | */ |
202 | 202 | public function getReport(ReportStatus $reportStatus) |
203 | 203 | { |
204 | - if (!$reportStatus->isReady()) { |
|
204 | + if ( ! $reportStatus->isReady()) { |
|
205 | 205 | throw ReportException::validation('report status not ready'); |
206 | 206 | } |
207 | 207 | |
208 | - if (!$reportStatus->getUrl()) { |
|
208 | + if ( ! $reportStatus->getUrl()) { |
|
209 | 209 | throw ReportException::validation('missing url in the report status'); |
210 | 210 | } |
211 | 211 | |
212 | - $cacheKey = self::CACHE_NAMESPACE.sha1($reportStatus->getUrl()); |
|
212 | + $cacheKey = self::CACHE_NAMESPACE . sha1($reportStatus->getUrl()); |
|
213 | 213 | |
214 | 214 | if ($this->isCacheEnabled()) { |
215 | 215 | if ($this->cache->contains($cacheKey)) { |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - $compiledUrl = $this->baseUrlDownload.$reportStatus->getUrl(); |
|
220 | + $compiledUrl = $this->baseUrlDownload . $reportStatus->getUrl(); |
|
221 | 221 | |
222 | 222 | $response = $this->client->request('GET', $compiledUrl); |
223 | 223 | |
224 | 224 | $lines = explode(PHP_EOL, $response->getBody()->getContents()); |
225 | 225 | $result = []; |
226 | 226 | foreach ($lines as $line) { |
227 | - if (!empty($line)) { |
|
227 | + if ( ! empty($line)) { |
|
228 | 228 | $result[] = str_getcsv($line); |
229 | 229 | } |
230 | 230 | } |
@@ -98,7 +98,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -78,7 +78,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |