@@ -175,9 +175,9 @@ |
||
| 175 | 175 | |
| 176 | 176 | $maxSteps = 0; |
| 177 | 177 | |
| 178 | - while (!$reportStatus->isReady() && $maxSteps < 10) { |
|
| 178 | + while ( ! $reportStatus->isReady() && $maxSteps < 10) { |
|
| 179 | 179 | $reportStatus = $this->report->getReportStatus($reportStatus); |
| 180 | - $maxSteps++; |
|
| 180 | + $maxSteps ++; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $this->report->getReport($reportStatus); |
@@ -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 | |
@@ -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 | |
@@ -185,11 +185,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |