@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | $randomString = ''; |
| 18 | 18 | |
| 19 | 19 | for ($i = 0; $i < $length; $i++) { |
| 20 | - $randomString .= $characters[rand(0, $charactersLength - 1)]; |
|
| 20 | + $randomString .= $characters[rand(0, $charactersLength-1)]; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | return $randomString; |
@@ -29,6 +29,6 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function pack(string $str): string |
| 31 | 31 | { |
| 32 | - return rtrim(strtr(base64_encode(pack('H*', hash('sha256', $str))), '+/', '-_'), '='); |
|
| 32 | + return rtrim(strtr(base64_encode(pack('H*', hash('sha256', $str))), '+/', '-_'), '='); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function fetch(int $id): ?Customer |
| 24 | 24 | { |
| 25 | 25 | /** @var Customer|null $fetch */ |
| 26 | - $fetch = $this->_get('api/customers/customer' . $id); |
|
| 26 | + $fetch = $this->_get('api/customers/customer'.$id); |
|
| 27 | 27 | return $fetch; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function update(int $id, array $data): ?Customer |
| 51 | 51 | { |
| 52 | 52 | /** @var Customer|null $post */ |
| 53 | - $post = $this->_post('api/customers/customer/' . $id, $data); |
|
| 53 | + $post = $this->_post('api/customers/customer/'.$id, $data); |
|
| 54 | 54 | return $post; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | public function fetch(int $id): ?Address |
| 24 | 24 | { |
| 25 | 25 | /** @var Address|null $address */ |
| 26 | - $address = $this->_get('api/addresses/address' . $id); |
|
| 26 | + $address = $this->_get('api/addresses/address'.$id); |
|
| 27 | 27 | return $address; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | public function update(int $id, array $data): ?Address |
| 51 | 51 | { |
| 52 | 52 | /** @var Address|null $address */ |
| 53 | - $address = $this->_post('api/addresses/address/' . $id, $data); |
|
| 53 | + $address = $this->_post('api/addresses/address/'.$id, $data); |
|
| 54 | 54 | return $address; |
| 55 | 55 | } |
| 56 | 56 | |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $t = $this->getItems(); |
| 63 | 63 | $c = $this->count(); |
| 64 | 64 | |
| 65 | - return (function () use ($t, $c) { |
|
| 65 | + return (function() use ($t, $c) { |
|
| 66 | 66 | $i = 0; |
| 67 | 67 | |
| 68 | 68 | while ($i < $c) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function fetch(int $id): ?CustomPage |
| 38 | 38 | { |
| 39 | 39 | /** @var CustomPage|null $fetch */ |
| 40 | - $fetch = $this->_get('api/pages/page' . $id); |
|
| 40 | + $fetch = $this->_get('api/pages/page'.$id); |
|
| 41 | 41 | return $fetch; |
| 42 | 42 | } |
| 43 | 43 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function update(int $id, array $data): ?CustomPage |
| 65 | 65 | { |
| 66 | 66 | /** @var CustomPage|null $post */ |
| 67 | - $post = $this->_post('api/pages/page/' . $id, $data); |
|
| 67 | + $post = $this->_post('api/pages/page/'.$id, $data); |
|
| 68 | 68 | return $post; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function fetch(int $id): ?Collection |
| 23 | 23 | { |
| 24 | 24 | /** @var Collection|null $fetch */ |
| 25 | - $fetch = $this->_get('api/collections/collection' . $id); |
|
| 25 | + $fetch = $this->_get('api/collections/collection'.$id); |
|
| 26 | 26 | return $fetch; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function update(int $id, array $data): ?Collection |
| 50 | 50 | { |
| 51 | 51 | /** @var Collection|null $post */ |
| 52 | - $post = $this->_post('api/collections/collection/' . $id, $data); |
|
| 52 | + $post = $this->_post('api/collections/collection/'.$id, $data); |
|
| 53 | 53 | return $post; |
| 54 | 54 | } |
| 55 | 55 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function delete(int $id): bool |
| 63 | 63 | { |
| 64 | - return $this->_delete('api/collections/collection/' . $id); |
|
| 64 | + return $this->_delete('api/collections/collection/'.$id); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -212,20 +212,20 @@ |
||
| 212 | 212 | $t = $this->getItems(1); |
| 213 | 213 | $c = $this->count(); |
| 214 | 214 | |
| 215 | - return (function () use ($t, $c) { |
|
| 215 | + return (function() use ($t, $c) { |
|
| 216 | 216 | $i = 0; |
| 217 | 217 | $x = 0; |
| 218 | 218 | |
| 219 | 219 | while ($i < $c) { |
| 220 | 220 | if ($x === 0) { |
| 221 | 221 | $x = $this->_page_length; |
| 222 | - $t = $this->getItems((int) floor($i / $this->_page_length) + 1); |
|
| 222 | + $t = $this->getItems((int) floor($i / $this->_page_length)+1); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - yield $i => $t[$this->_page_length - $x]; |
|
| 225 | + yield $i => $t[$this->_page_length-$x]; |
|
| 226 | 226 | |
| 227 | 227 | $x -= 1; |
| 228 | - $i ++; |
|
| 228 | + $i++; |
|
| 229 | 229 | } |
| 230 | 230 | })(); |
| 231 | 231 | } |
@@ -21,11 +21,11 @@ |
||
| 21 | 21 | public function __construct(string $_api_key, string $_api_secret, $_auth_domain = self::AUTH_DOMAIN) |
| 22 | 22 | { |
| 23 | 23 | if (!$_api_key) { |
| 24 | - throw new InvalidArgumentException(static::class . ' parameter 1 should be your api key'); |
|
| 24 | + throw new InvalidArgumentException(static::class.' parameter 1 should be your api key'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | if (!$_api_secret) { |
| 28 | - throw new InvalidArgumentException(static::class . ' parameter 2 should be your api secret'); |
|
| 28 | + throw new InvalidArgumentException(static::class.' parameter 2 should be your api secret'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $this->_api_key = $_api_key; |
@@ -54,10 +54,10 @@ |
||
| 54 | 54 | { |
| 55 | 55 | $app = new App('id', 'secret', 'http://test.domain'); |
| 56 | 56 | $url = $app->getAuthURL('process.php', 'error.php', 'challenge'); |
| 57 | - $expect = 'http://test.domain/oauth/code?app_id=id&process_url=' . |
|
| 58 | - urlencode('process.php') . |
|
| 59 | - '&error_url=' . urlencode('error.php') . |
|
| 60 | - '&challenge=' . Utils::pack('challenge'); |
|
| 57 | + $expect = 'http://test.domain/oauth/code?app_id=id&process_url='. |
|
| 58 | + urlencode('process.php'). |
|
| 59 | + '&error_url='.urlencode('error.php'). |
|
| 60 | + '&challenge='.Utils::pack('challenge'); |
|
| 61 | 61 | |
| 62 | 62 | $this->assertEquals($expect, $url); |
| 63 | 63 | } |