@@ -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); |
|
48 | + $cacheKey = self::CACHE_NAMESPACE . sha1($username . $password); |
|
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 |
@@ -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); |
|
48 | + $cacheKey = self::CACHE_NAMESPACE . sha1($username . $password); |
|
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 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @return RepositoryResponse |
59 | 59 | * @throws \Exception |
60 | 60 | */ |
61 | - public function upload($fileAsString,$memberId){ |
|
61 | + public function upload($fileAsString, $memberId) { |
|
62 | 62 | |
63 | 63 | $tempFile = tmpfile(); |
64 | 64 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $responseContent = json_decode($stream->getContents(), true); |
83 | 83 | |
84 | 84 | |
85 | - print_r($responseContent);die(); |
|
85 | + print_r($responseContent); die(); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | |
@@ -103,17 +103,17 @@ discard block |
||
103 | 103 | public function getUploadUrl($memberId) |
104 | 104 | { |
105 | 105 | |
106 | - $compiledUrl = self::BASE_URL.'?member_id='.$memberId; |
|
106 | + $compiledUrl = self::BASE_URL . '?member_id=' . $memberId; |
|
107 | 107 | |
108 | 108 | $response = $this->client->request('POST', $compiledUrl); |
109 | 109 | |
110 | 110 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
111 | 111 | |
112 | - if (!$repositoryResponse->isSuccessful()) { |
|
112 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
113 | 113 | throw new \Exception('name me'); |
114 | 114 | } |
115 | 115 | |
116 | - if (!isset($responseContent['response']['batch_segment_upload_job']['upload_url'])) { |
|
116 | + if ( ! isset($responseContent['response']['batch_segment_upload_job']['upload_url'])) { |
|
117 | 117 | throw new \Exception('name me'); |
118 | 118 | } |
119 | 119 |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | public function add(Segment $segment) |
55 | 55 | { |
56 | 56 | |
57 | - $compiledUrl = self::BASE_URL.$segment->getMemberId(); |
|
57 | + $compiledUrl = self::BASE_URL . $segment->getMemberId(); |
|
58 | 58 | |
59 | 59 | $payload = [ |
60 | 60 | 'segment' => $segment->torray(), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $responseContent = json_decode($stream->getContents(), true); |
71 | 71 | $stream->rewind(); |
72 | 72 | |
73 | - if (!(isset($responseContent['response']['segment']['id']))) { |
|
73 | + if ( ! (isset($responseContent['response']['segment']['id']))) { |
|
74 | 74 | throw RepositoryException::wrongFormat(serialize($responseContent)); |
75 | 75 | } |
76 | 76 | |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function remove($id, $memberId) |
91 | 91 | { |
92 | 92 | |
93 | - $compiledUrl = self::BASE_URL.$memberId.'/'.$id; |
|
93 | + $compiledUrl = self::BASE_URL . $memberId . '/' . $id; |
|
94 | 94 | |
95 | 95 | $response = $this->client->request('DELETE', $compiledUrl); |
96 | 96 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | public function update(Segment $segment) |
110 | 110 | { |
111 | 111 | |
112 | - if (!$segment->getId()) { |
|
112 | + if ( ! $segment->getId()) { |
|
113 | 113 | throw new \Exception('name me - missing id'); |
114 | 114 | } |
115 | 115 | |
116 | - $compiledUrl = self::BASE_URL.$segment->getMemberId().'/'.$segment->getId(); |
|
116 | + $compiledUrl = self::BASE_URL . $segment->getMemberId() . '/' . $segment->getId(); |
|
117 | 117 | |
118 | 118 | $payload = [ |
119 | 119 | 'segment' => $segment->torray(), |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | public function findOneById($id, $memberId) |
137 | 137 | { |
138 | 138 | |
139 | - $compiledUrl = self::BASE_URL.$memberId.'/'.$id; |
|
139 | + $compiledUrl = self::BASE_URL . $memberId . '/' . $id; |
|
140 | 140 | |
141 | 141 | $response = $this->client->request('GET', $compiledUrl); |
142 | 142 | |
143 | 143 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
144 | 144 | |
145 | - if (!$repositoryResponse->isSuccessful()) { |
|
145 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
146 | 146 | return null; |
147 | 147 | } |
148 | 148 | |
@@ -165,20 +165,20 @@ discard block |
||
165 | 165 | { |
166 | 166 | |
167 | 167 | if ($this->isCacheEnabled()) { |
168 | - $cacheKey = self::CACHE_NAMESPACE.sha1($memberId.$start.$maxResults); |
|
168 | + $cacheKey = self::CACHE_NAMESPACE . sha1($memberId . $start . $maxResults); |
|
169 | 169 | if ($this->cache->contains($cacheKey)) { |
170 | 170 | return $this->cache->fetch($cacheKey); |
171 | 171 | } |
172 | 172 | |
173 | 173 | } |
174 | 174 | |
175 | - $compiledUrl = self::BASE_URL.$memberId."?start_element=$start&num_elements=$maxResults"; |
|
175 | + $compiledUrl = self::BASE_URL . $memberId . "?start_element=$start&num_elements=$maxResults"; |
|
176 | 176 | |
177 | 177 | $response = $this->client->request('GET', $compiledUrl); |
178 | 178 | |
179 | 179 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
180 | 180 | |
181 | - if (!$repositoryResponse->isSuccessful()) { |
|
181 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
182 | 182 | return null; |
183 | 183 | } |
184 | 184 |