@@ -25,8 +25,8 @@ |
||
| 25 | 25 | $this->responseArray = json_decode((string) $this->exception->getResponse()->getBody(), true); |
| 26 | 26 | |
| 27 | 27 | parent::__construct( |
| 28 | - 'Path: ' . $exception->getRequest()->getUri()->getPath() . |
|
| 29 | - ', Message: ' . (string)$exception->getResponse()->getBody(), |
|
| 28 | + 'Path: '.$exception->getRequest()->getUri()->getPath(). |
|
| 29 | + ', Message: '.(string) $exception->getResponse()->getBody(), |
|
| 30 | 30 | $exception->getCode() |
| 31 | 31 | ); |
| 32 | 32 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | Middleware::mapRequest(new RequestSignatureMiddleware($certificateStorage->load(CertificateType::PRIVATE_KEY()))) |
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | - return self::createBaseClient((string)$url, $handlerStack); |
|
| 36 | + return self::createBaseClient((string) $url, $handlerStack); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $verify = openssl_verify( |
| 46 | 46 | $signatureData, |
| 47 | 47 | $decodedServerSignature, |
| 48 | - (string)$this->publicKey, |
|
| 48 | + (string) $this->publicKey, |
|
| 49 | 49 | self::SIGNATURE_ALGORITHM |
| 50 | 50 | ); |
| 51 | 51 | |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $signatureData = $response->getStatusCode(); |
| 67 | 67 | $signatureData .= $this->convertHeadersToSignatureData($response); |
| 68 | 68 | $signatureData .= "\n\n"; |
| 69 | - $signatureData .= (string)$response->getBody(); |
|
| 69 | + $signatureData .= (string) $response->getBody(); |
|
| 70 | 70 | |
| 71 | 71 | return $signatureData; |
| 72 | 72 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | |
| 96 | 96 | // Add all header data to verify signature |
| 97 | 97 | foreach ($values as $value) { |
| 98 | - $signatureData .= PHP_EOL . $header . ': ' . $value; |
|
| 98 | + $signatureData .= PHP_EOL.$header.': '.$value; |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public static function request() |
| 25 | 25 | { |
| 26 | - return function (RequestInterface $request) { |
|
| 27 | - echo chr(27) . '[33m' . "REQUEST: " . $request->getMethod() . ' ' . $request->getRequestTarget() . chr( |
|
| 26 | + return function(RequestInterface $request) { |
|
| 27 | + echo chr(27).'[33m'."REQUEST: ".$request->getMethod().' '.$request->getRequestTarget().chr( |
|
| 28 | 28 | 27 |
| 29 | - ) . "[0m\n"; |
|
| 29 | + )."[0m\n"; |
|
| 30 | 30 | |
| 31 | 31 | foreach ($request->getHeaders() as $key => $headers) { |
| 32 | 32 | foreach ($headers as $header) { |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $body = (string)$request->getBody(); |
|
| 37 | + $body = (string) $request->getBody(); |
|
| 38 | 38 | echo $body; |
| 39 | 39 | $json = @json_decode($body, true); |
| 40 | 40 | if ($json === null) { |
@@ -49,10 +49,10 @@ discard block |
||
| 49 | 49 | */ |
| 50 | 50 | public static function response() |
| 51 | 51 | { |
| 52 | - return function (RequestInterface $request, $options, FulfilledPromise $responsePromise) { |
|
| 52 | + return function(RequestInterface $request, $options, FulfilledPromise $responsePromise) { |
|
| 53 | 53 | $responsePromise->then( |
| 54 | - function (ResponseInterface $response) { |
|
| 55 | - echo chr(27) . '[33m' . "RESPONSE: HTTP/" . $response->getProtocolVersion() . ' ' . $response->getStatusCode() . ' ' . $response->getReasonPhrase() . chr(27) . "[0m\n"; |
|
| 54 | + function(ResponseInterface $response) { |
|
| 55 | + echo chr(27).'[33m'."RESPONSE: HTTP/".$response->getProtocolVersion().' '.$response->getStatusCode().' '.$response->getReasonPhrase().chr(27)."[0m\n"; |
|
| 56 | 56 | |
| 57 | 57 | foreach ($response->getHeaders() as $key => $headers) { |
| 58 | 58 | foreach ($headers as $header) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | - $body = (string)$response->getBody(); |
|
| 63 | + $body = (string) $response->getBody(); |
|
| 64 | 64 | $json = @json_decode($body, true); |
| 65 | 65 | if ($json === null) { |
| 66 | 66 | $json = []; |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | $headers = $request->getHeaders(); |
| 56 | 56 | ksort($headers); |
| 57 | 57 | |
| 58 | - $signatureData = $request->getMethod() . ' ' . $request->getRequestTarget(); |
|
| 58 | + $signatureData = $request->getMethod().' '.$request->getRequestTarget(); |
|
| 59 | 59 | $signatureData .= $this->createSignatureDataFromHeaders($headers); |
| 60 | 60 | $signatureData .= "\n\n"; |
| 61 | 61 | |
| 62 | - $body = (string)$request->getBody(); |
|
| 62 | + $body = (string) $request->getBody(); |
|
| 63 | 63 | if (!empty($body)) { |
| 64 | 64 | $signatureData .= $body; |
| 65 | 65 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | || $header === 'Cache-Control' |
| 83 | 83 | || substr($header, 0, 7) === 'X-Bunq-' |
| 84 | 84 | ) { |
| 85 | - $signatureData .= PHP_EOL . $header . ': ' . $value; |
|
| 85 | + $signatureData .= PHP_EOL.$header.': '.$value; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | private function sign($data) |
| 100 | 100 | { |
| 101 | - if (openssl_sign((string)$data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) { |
|
| 102 | - throw new \Exception("Could not sign request: " . openssl_error_string()); |
|
| 101 | + if (openssl_sign((string) $data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) { |
|
| 102 | + throw new \Exception("Could not sign request: ".openssl_error_string()); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $signature; |
@@ -32,7 +32,7 @@ |
||
| 32 | 32 | |
| 33 | 33 | // Use the session token if not overridden with installation token |
| 34 | 34 | if (!isset($headers['X-Bunq-Client-Authentication'])) { |
| 35 | - $headers['X-Bunq-Client-Authentication'] = (string)$this->sessionToken->toString(); |
|
| 35 | + $headers['X-Bunq-Client-Authentication'] = (string) $this->sessionToken->toString(); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | return new Request( |
@@ -17,6 +17,6 @@ |
||
| 17 | 17 | |
| 18 | 18 | $this->assertInstanceOf(Token::class, $token); |
| 19 | 19 | $this->assertSame('string', $token->toString()); |
| 20 | - $this->assertSame('string', (string)$token); |
|
| 20 | + $this->assertSame('string', (string) $token); |
|
| 21 | 21 | } |
| 22 | 22 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | |
| 17 | 17 | $this->assertInstanceOf(TokenType::class, $token); |
| 18 | 18 | $this->assertEquals('installation.token', $token->toString()); |
| 19 | - $this->assertEquals('installation.token', (string)$token); |
|
| 19 | + $this->assertEquals('installation.token', (string) $token); |
|
| 20 | 20 | |
| 21 | 21 | $this->assertTrue($token->equals(TokenType::INSTALLATION_TOKEN())); |
| 22 | 22 | $this->assertFalse($token->equals(TokenType::SESSION_TOKEN())); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | $tokenType = TokenType::INSTALLATION_TOKEN(); |
| 28 | 28 | |
| 29 | 29 | @mkdir('/tmp/tokens'); |
| 30 | - file_put_contents('/tmp/tokens/' . $tokenType->toString(), 'tokenstring'); |
|
| 30 | + file_put_contents('/tmp/tokens/'.$tokenType->toString(), 'tokenstring'); |
|
| 31 | 31 | |
| 32 | 32 | $result = $this->storage->load($tokenType); |
| 33 | 33 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->storage->save($token, $tokenType); |
| 58 | 58 | |
| 59 | - $result = @file_get_contents('/tmp/tokens/' . $tokenType->toString()); |
|
| 59 | + $result = @file_get_contents('/tmp/tokens/'.$tokenType->toString()); |
|
| 60 | 60 | |
| 61 | 61 | $this->assertSame($token->toString(), $result); |
| 62 | 62 | } |