@@ -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 = []) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $response = $this->client->request($method, $uri, $options); |
| 86 | 86 | |
| 87 | - if (!$this->needToRevalidate($response)) { |
|
| 87 | + if ( ! $this->needToRevalidate($response)) { |
|
| 88 | 88 | return $response; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | public function autenticate($skipCache = false) |
| 110 | 110 | { |
| 111 | 111 | |
| 112 | - if ($this->cacheEnabled && !$skipCache) { |
|
| 113 | - $cacheKey = self::CACHE_NAMESPACE.sha1($this->username.$this->password); |
|
| 112 | + if ($this->cacheEnabled && ! $skipCache) { |
|
| 113 | + $cacheKey = self::CACHE_NAMESPACE . sha1($this->username . $this->password); |
|
| 114 | 114 | if ($this->cache->contains($cacheKey)) { |
| 115 | 115 | return $this->cache->fetch($cacheKey); |
| 116 | 116 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $contentArray = json_decode($content, true); |
| 131 | 131 | |
| 132 | - if (!isset($contentArray["response"]["token"])) { |
|
| 132 | + if ( ! isset($contentArray["response"]["token"])) { |
|
| 133 | 133 | throw new AuthException($content); |
| 134 | 134 | } |
| 135 | 135 | |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | - * @param $jsonEncodedResponse |
|
| 33 | + * @param \Psr\Http\Message\ResponseInterface $jsonEncodedResponse |
|
| 34 | 34 | * |
| 35 | 35 | * @return RepositoryResponse |
| 36 | 36 | */ |
@@ -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 |
@@ -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,13 +90,13 @@ discard block |
||
| 90 | 90 | public function findOneById($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('GET', $compiledUrl); |
| 96 | 96 | |
| 97 | 97 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
| 98 | 98 | |
| 99 | - if (!$repositoryResponse->isSuccessful()) { |
|
| 99 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
| 100 | 100 | return null; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | public function remove($id, $memberId) |
| 118 | 118 | { |
| 119 | 119 | |
| 120 | - $compiledUrl = self::BASE_URL.$memberId.'/'.$id; |
|
| 120 | + $compiledUrl = self::BASE_URL . $memberId . '/' . $id; |
|
| 121 | 121 | |
| 122 | 122 | $response = $this->client->request('DELETE', $compiledUrl); |
| 123 | 123 | |
@@ -138,20 +138,20 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | |
| 140 | 140 | if ($this->isCacheEnabled()) { |
| 141 | - $cacheKey = self::CACHE_NAMESPACE.sha1($memberId.$start.$maxResults); |
|
| 141 | + $cacheKey = self::CACHE_NAMESPACE . sha1($memberId . $start . $maxResults); |
|
| 142 | 142 | if ($this->cache->contains($cacheKey)) { |
| 143 | 143 | return $this->cache->fetch($cacheKey); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $compiledUrl = self::BASE_URL.$memberId."?start_element=$start&num_elements=$maxResults"; |
|
| 148 | + $compiledUrl = self::BASE_URL . $memberId . "?start_element=$start&num_elements=$maxResults"; |
|
| 149 | 149 | |
| 150 | 150 | $response = $this->client->request('GET', $compiledUrl); |
| 151 | 151 | |
| 152 | 152 | $repositoryResponse = RepositoryResponse::fromResponse($response); |
| 153 | 153 | |
| 154 | - if (!$repositoryResponse->isSuccessful()) { |
|
| 154 | + if ( ! $repositoryResponse->isSuccessful()) { |
|
| 155 | 155 | return null; |
| 156 | 156 | } |
| 157 | 157 | |
@@ -183,11 +183,11 @@ discard block |
||
| 183 | 183 | public function update(Segment $segment) |
| 184 | 184 | { |
| 185 | 185 | |
| 186 | - if (!$segment->getId()) { |
|
| 186 | + if ( ! $segment->getId()) { |
|
| 187 | 187 | throw new \Exception('name me - missing id'); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $compiledUrl = self::BASE_URL.$segment->getMemberId().'/'.$segment->getId(); |
|
| 190 | + $compiledUrl = self::BASE_URL . $segment->getMemberId() . '/' . $segment->getId(); |
|
| 191 | 191 | |
| 192 | 192 | $payload = [ |
| 193 | 193 | 'segment' => $segment->torray(), |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | $responseContent = json_decode($stream->getContents(), true); |
| 204 | 204 | $stream->rewind(); |
| 205 | 205 | |
| 206 | - if (!(isset($responseContent['response']['segment']['id']))) { |
|
| 206 | + if ( ! (isset($responseContent['response']['segment']['id']))) { |
|
| 207 | 207 | throw RepositoryException::wrongFormat(serialize($responseContent)); |
| 208 | 208 | } |
| 209 | 209 | |