@@ -70,7 +70,7 @@ |
||
70 | 70 | * @param null $uri |
71 | 71 | * @param array $options |
72 | 72 | * |
73 | - * @return mixed|\Psr\Http\Message\ResponseInterface |
|
73 | + * @return \Psr\Http\Message\ResponseInterface |
|
74 | 74 | * @throws \Exception |
75 | 75 | */ |
76 | 76 | public function request($method, $uri = null, array $options = []) |
@@ -76,7 +76,7 @@ |
||
76 | 76 | |
77 | 77 | $response = $this->client->request($method, $uri, $options); |
78 | 78 | |
79 | - if (!$this->needToRevalidate($response)) { |
|
79 | + if ( ! $this->needToRevalidate($response)) { |
|
80 | 80 | return $response; |
81 | 81 | } |
82 | 82 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public static function authFailed($reason) |
17 | 17 | { |
18 | - return new self(self::DEFAULT_MESSAGE.$reason, 0, null); |
|
18 | + return new self(self::DEFAULT_MESSAGE . $reason, 0, null); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | umask(0000); |
4 | 4 | |
5 | -if(function_exists('xdebug_disable')) { |
|
5 | +if (function_exists('xdebug_disable')) { |
|
6 | 6 | xdebug_disable(); |
7 | 7 | } |
8 | 8 | |
9 | -include(__DIR__.'/vendor/autoload.php'); |
|
10 | 9 | \ No newline at end of file |
10 | +include(__DIR__ . '/vendor/autoload.php'); |
|
11 | 11 | \ No newline at end of file |
@@ -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 |
@@ -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 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function add(Segment $segment) |
56 | 56 | { |
57 | 57 | |
58 | - $compiledUrl = self::BASE_URL.$segment->getMemberId(); |
|
58 | + $compiledUrl = self::BASE_URL . $segment->getMemberId(); |
|
59 | 59 | |
60 | 60 | $payload = [ |
61 | 61 | 'segment' => $segment->toArray(), |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $responseContent = json_decode($stream->getContents(), true); |
72 | 72 | $stream->rewind(); |
73 | 73 | |
74 | - if (!(isset($responseContent['response']['segment']['id']))) { |
|
74 | + if ( ! (isset($responseContent['response']['segment']['id']))) { |
|
75 | 75 | throw RepositoryException::wrongFormat(serialize($responseContent)); |
76 | 76 | } |
77 | 77 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | public function remove($memberId, $id) |
92 | 92 | { |
93 | 93 | |
94 | - $compiledUrl = self::BASE_URL.$memberId.'/'.$id; |
|
94 | + $compiledUrl = self::BASE_URL . $memberId . '/' . $id; |
|
95 | 95 | |
96 | 96 | $response = $this->client->request('DELETE', $compiledUrl); |
97 | 97 | |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | public function update(Segment $segment) |
111 | 111 | { |
112 | 112 | |
113 | - if (!$segment->getId()) { |
|
113 | + if ( ! $segment->getId()) { |
|
114 | 114 | throw new \Exception('name me - missing id'); |
115 | 115 | } |
116 | 116 | |
117 | - $compiledUrl = self::BASE_URL.$segment->getMemberId().'/'.$segment->getId(); |
|
117 | + $compiledUrl = self::BASE_URL . $segment->getMemberId() . '/' . $segment->getId(); |
|
118 | 118 | |
119 | 119 | $payload = [ |
120 | 120 | 'segment' => $segment->toArray(), |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | public function findOneById($memberId, $id) |
138 | 138 | { |
139 | 139 | |
140 | - $compiledUrl = self::BASE_URL.$memberId.'/'.$id; |
|
140 | + $compiledUrl = self::BASE_URL . $memberId . '/' . $id; |
|
141 | 141 | |
142 | 142 | $response = $this->client->request('GET', $compiledUrl); |
143 | 143 | |
144 | 144 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
145 | 145 | |
146 | - if (!$repositoryResponse->isSuccessful()) { |
|
146 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
147 | 147 | return null; |
148 | 148 | } |
149 | 149 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function findAll($memberId, $start = 0, $maxResults = 100) |
167 | 167 | { |
168 | 168 | |
169 | - $cacheKey = self::CACHE_NAMESPACE.sha1($memberId.$start.$maxResults); |
|
169 | + $cacheKey = self::CACHE_NAMESPACE . sha1($memberId . $start . $maxResults); |
|
170 | 170 | |
171 | 171 | if ($this->isCacheEnabled()) { |
172 | 172 | if ($this->cache->contains($cacheKey)) { |
@@ -174,13 +174,13 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | - $compiledUrl = self::BASE_URL.$memberId."?start_element=$start&num_elements=$maxResults"; |
|
177 | + $compiledUrl = self::BASE_URL . $memberId . "?start_element=$start&num_elements=$maxResults"; |
|
178 | 178 | |
179 | 179 | $response = $this->client->request('GET', $compiledUrl); |
180 | 180 | |
181 | 181 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
182 | 182 | |
183 | - if (!$repositoryResponse->isSuccessful()) { |
|
183 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
184 | 184 | return null; |
185 | 185 | } |
186 | 186 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | |
191 | 191 | $result = []; |
192 | 192 | |
193 | - if (!$responseContent['response']['segments']) { |
|
193 | + if ( ! $responseContent['response']['segments']) { |
|
194 | 194 | throw new \Exception('name me -missing index'); |
195 | 195 | } |
196 | 196 |
@@ -105,7 +105,7 @@ |
||
105 | 105 | $self->setSuccessful($responseArray['response']['status'] == self::STATUS_SUCCESS); |
106 | 106 | } |
107 | 107 | |
108 | - if (!$self->isSuccessful()) { |
|
108 | + if ( ! $self->isSuccessful()) { |
|
109 | 109 | $error = Error::fromArray($responseArray['response']); |
110 | 110 | } |
111 | 111 |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public static function missingId(Segment $segment) |
30 | 30 | { |
31 | - return new self('Missing segment id for '.serialize($segment->getCode())); |
|
31 | + return new self('Missing segment id for ' . serialize($segment->getCode())); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function failed(RepositoryResponse $repositoryResponse) |
40 | 40 | { |
41 | - return new self('Failed call: '.$repositoryResponse->getError()->getError()); |
|
41 | + return new self('Failed call: ' . $repositoryResponse->getError()->getError()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /**+ |
@@ -48,6 +48,6 @@ discard block |
||
48 | 48 | */ |
49 | 49 | public static function missingIndex($missingIndex) |
50 | 50 | { |
51 | - return new self('Invalid reposnse missing: '. $missingIndex); |
|
51 | + return new self('Invalid reposnse missing: ' . $missingIndex); |
|
52 | 52 | } |
53 | 53 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
76 | 76 | |
77 | - if (!$repositoryResponse->isSuccessful()) { |
|
77 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
78 | 78 | throw UploadException::failed($repositoryResponse); |
79 | 79 | } |
80 | 80 | |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | public function getUploadTicket($memberId) |
92 | 92 | { |
93 | 93 | |
94 | - $compiledUrl = self::BASE_URL.'?member_id='.$memberId; |
|
94 | + $compiledUrl = self::BASE_URL . '?member_id=' . $memberId; |
|
95 | 95 | |
96 | 96 | $response = $this->client->request('POST', $compiledUrl); |
97 | 97 | |
98 | 98 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
99 | 99 | |
100 | - if (!$repositoryResponse->isSuccessful()) { |
|
100 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
101 | 101 | throw UploadException::failed($repositoryResponse); |
102 | 102 | } |
103 | 103 | |
104 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'])) { |
|
104 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'])) { |
|
105 | 105 | throw UploadException::missingIndex('response->batch_segment_upload_job'); |
106 | 106 | } |
107 | 107 | |
@@ -122,17 +122,17 @@ discard block |
||
122 | 122 | public function getJobStatus(UploadTicket $uploadTicket) |
123 | 123 | { |
124 | 124 | |
125 | - $compiledUrl = self::BASE_URL."?member_id={$uploadTicket->getMemberId()}&job_id={$uploadTicket->getJobId()}"; |
|
125 | + $compiledUrl = self::BASE_URL . "?member_id={$uploadTicket->getMemberId()}&job_id={$uploadTicket->getJobId()}"; |
|
126 | 126 | |
127 | 127 | $response = $this->client->request('GET', $compiledUrl); |
128 | 128 | |
129 | 129 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
130 | 130 | |
131 | - if (!$repositoryResponse->isSuccessful()) { |
|
131 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
132 | 132 | throw UploadException::failed($repositoryResponse); |
133 | 133 | } |
134 | 134 | |
135 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) { |
|
135 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) { |
|
136 | 136 | throw UploadException::missingIndex('response->batch_segment_upload_job->0'); |
137 | 137 | } |
138 | 138 | |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | public function getUploadHistory($memberId, $start = 0, $maxResults = 100) |
157 | 157 | { |
158 | 158 | |
159 | - $compiledUrl = self::BASE_URL."?member_id=$memberId&start_element=$start&num_elements=$maxResults"; |
|
159 | + $compiledUrl = self::BASE_URL . "?member_id=$memberId&start_element=$start&num_elements=$maxResults"; |
|
160 | 160 | |
161 | 161 | $response = $this->client->request('GET', $compiledUrl); |
162 | 162 | |
163 | 163 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
164 | 164 | |
165 | - if (!$repositoryResponse->isSuccessful()) { |
|
165 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
166 | 166 | throw UploadException::failed($repositoryResponse); |
167 | 167 | } |
168 | 168 | |
169 | - if (!isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) { |
|
169 | + if ( ! isset($repositoryResponse->getResponseAsArray()['response']['batch_segment_upload_job'][0])) { |
|
170 | 170 | throw UploadException::missingIndex('response->batch_segment_upload_job->0'); |
171 | 171 | } |
172 | 172 |