@@ -65,7 +65,7 @@ |
||
65 | 65 | $headers = AuthenticationHelper::getOAuthHeader($accessToken); |
66 | 66 | $body = self::getCompleteCheckoutBody($checkout); |
67 | 67 | |
68 | - if($checkout->getCurrency==='BRL') { |
|
68 | + if ($checkout->getCurrency === 'BRL') { |
|
69 | 69 | $body['installments'] = $checkout->getInstallments(); |
70 | 70 | } |
71 | 71 |
@@ -32,9 +32,9 @@ discard block |
||
32 | 32 | $propertyTree = explode('.', $propertyPath); |
33 | 33 | $size = count($propertyTree); |
34 | 34 | $data = $this->response->json(); |
35 | - for($i=0; $i<$size;$i++) |
|
35 | + for ($i = 0; $i < $size; $i++) |
|
36 | 36 | { |
37 | - if(!isset($data[$propertyTree[$i]])) |
|
37 | + if (!isset($data[$propertyTree[$i]])) |
|
38 | 38 | { |
39 | 39 | return null; |
40 | 40 | } |
@@ -58,19 +58,19 @@ discard block |
||
58 | 58 | |
59 | 59 | function hydrate(&$object, $data = null) |
60 | 60 | { |
61 | - if($data === null){ |
|
61 | + if ($data === null) { |
|
62 | 62 | $data = $this->response->json(); |
63 | 63 | } |
64 | 64 | |
65 | 65 | $suppressedData = $this->suppressDataPaths($data); |
66 | 66 | |
67 | - foreach($suppressedData as $prop => $value) |
|
67 | + foreach ($suppressedData as $prop => $value) |
|
68 | 68 | { |
69 | - $method = 'set'.replate('_', '', ucwords($prop, '_')); |
|
70 | - if(method_exists($object, $method)){ |
|
69 | + $method = 'set' . replate('_', '', ucwords($prop, '_')); |
|
70 | + if (method_exists($object, $method)) { |
|
71 | 71 | $object->$method($value); |
72 | - }else{ |
|
73 | - error_log('BPCI\SumUp Lib Error: Method '.get_class($object).'::'.$method.' does not exists!'); |
|
72 | + }else { |
|
73 | + error_log('BPCI\SumUp Lib Error: Method ' . get_class($object) . '::' . $method . ' does not exists!'); |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $suppressedData = []; |
81 | 81 | $suppressedPaths = $this->suppressedPaths; |
82 | 82 | array_map(function($value, $path) use ($suppressedPaths, $suppressedData) { |
83 | - foreach($suppressedPaths as $sPath){ |
|
83 | + foreach ($suppressedPaths as $sPath) { |
|
84 | 84 | $suppressedData[replace($sPath, '', $path)] = $value; |
85 | 85 | } |
86 | 86 | }, $data); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | $method = 'set'.replate('_', '', ucwords($prop, '_')); |
70 | 70 | if(method_exists($object, $method)){ |
71 | 71 | $object->$method($value); |
72 | - }else{ |
|
72 | + } else{ |
|
73 | 73 | error_log('BPCI\SumUp Lib Error: Method '.get_class($object).'::'.$method.' does not exists!'); |
74 | 74 | } |
75 | 75 | } |
@@ -12,7 +12,7 @@ |
||
12 | 12 | const SEK = 'SEK'; |
13 | 13 | const USD = 'USD'; |
14 | 14 | |
15 | - static function isValid(string $currency){ |
|
15 | + static function isValid(string $currency) { |
|
16 | 16 | $currencies = self::getCurrencies(); |
17 | 17 | return in_array($currency, $currencies); |
18 | 18 | } |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace BPCI\SumUp\Exception; |
4 | 4 | |
5 | -class FileNotFoundException extends \RuntimeException{ |
|
5 | +class FileNotFoundException extends \RuntimeException { |
|
6 | 6 | private $path; |
7 | 7 | public function __construct(string $message, int $code = 0, \Exception $previous = null, string $path = null) |
8 | 8 | { |
@@ -3,5 +3,5 @@ |
||
3 | 3 | |
4 | 4 | use GuzzleHttp\Exception\RequestException; |
5 | 5 | |
6 | -class BadRequestException extends RequestException{ |
|
6 | +class BadRequestException extends RequestException { |
|
7 | 7 | } |
8 | 8 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
6 | 6 | use BPCI\SumUp\OAuth\AccessToken; |
7 | 7 | use BPCI\SumUp\Customer\CustomerInterface; |
8 | 8 | |
9 | -interface CardClientInterface extends SumUpClientInterface{ |
|
9 | +interface CardClientInterface extends SumUpClientInterface { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Create a new card resource and fill the $card Object with response. |
@@ -58,7 +58,7 @@ |
||
58 | 58 | 'headers' => $headers |
59 | 59 | ], $body); |
60 | 60 | $successul = $response->getStatusCode() === 201; |
61 | - } catch(\GuzzleHttp\Exception\RequestException $e){ |
|
61 | + } catch (\GuzzleHttp\Exception\RequestException $e) { |
|
62 | 62 | throw new BadRequestException( |
63 | 63 | $e->getMessage(), |
64 | 64 | $e->getRequest(), |
@@ -135,10 +135,10 @@ |
||
135 | 135 | */ |
136 | 136 | public function setAddress($address): CustomerInterface |
137 | 137 | { |
138 | - if($address instanceof AddressInterface) |
|
138 | + if ($address instanceof AddressInterface) |
|
139 | 139 | { |
140 | 140 | $this->address = $address; |
141 | - }else{ |
|
141 | + }else { |
|
142 | 142 | $this->address = new Address($address); |
143 | 143 | } |
144 | 144 |
@@ -138,7 +138,7 @@ |
||
138 | 138 | if($address instanceof AddressInterface) |
139 | 139 | { |
140 | 140 | $this->address = $address; |
141 | - }else{ |
|
141 | + } else{ |
|
142 | 142 | $this->address = new Address($address); |
143 | 143 | } |
144 | 144 |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | * @param string $type |
20 | 20 | * @param integer $expiresIn |
21 | 21 | */ |
22 | - function __construct(string $token, string $type, int $expiresIn, string $scope = null){ |
|
22 | + function __construct(string $token, string $type, int $expiresIn, string $scope = null) { |
|
23 | 23 | $this->token = $token; |
24 | 24 | $this->type = $type; |
25 | 25 | $this->expiration = time() + $expiresIn; |
26 | 26 | |
27 | - if($scope !== null) { |
|
27 | + if ($scope !== null) { |
|
28 | 28 | $this->scope = $scope; |
29 | 29 | } |
30 | 30 | } |
@@ -85,9 +85,9 @@ discard block |
||
85 | 85 | * @param string $scope[,$scope[,$scope[,...]]] |
86 | 86 | * @return boolean |
87 | 87 | */ |
88 | - function canAccess(string $scope){ |
|
88 | + function canAccess(string $scope) { |
|
89 | 89 | $scopes = func_get_args(); |
90 | 90 | $diff = array_diff($scopes, $this->scope); |
91 | - return count($diff)>0; |
|
91 | + return count($diff) > 0; |
|
92 | 92 | } |
93 | 93 | } |