@@ -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 | { |
@@ -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. |
@@ -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 | } |
@@ -81,14 +81,14 @@ |
||
81 | 81 | */ |
82 | 82 | public static function loadContextFromFile(string $filePath): ContextInterface |
83 | 83 | { |
84 | - if(!file_exists($filePath)){ |
|
85 | - throw new Exception\FileNotFoundException('Context file not found: '.$filePath, 404, null, $filePath); |
|
84 | + if (!file_exists($filePath)) { |
|
85 | + throw new Exception\FileNotFoundException('Context file not found: ' . $filePath, 404, null, $filePath); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $contents = file_get_contents($filePath); |
89 | 89 | $context_array = json_decode($contents, true); |
90 | 90 | |
91 | - if($context_array === null){ |
|
91 | + if ($context_array === null) { |
|
92 | 92 | throw new Exception\MalformedJsonException('JSON sintax error.'); |
93 | 93 | } |
94 | 94 |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | function fillProperty(string $property, $value) |
30 | 30 | { |
31 | 31 | $property = lcfirst(str_replace('_', '', ucwords($property, '_'))); |
32 | - if(property_exists(__CLASS__, $property)) |
|
32 | + if (property_exists(__CLASS__, $property)) |
|
33 | 33 | { |
34 | 34 | $method = sprintf('set%s', ucfirst($property)); |
35 | 35 | $this->{$method}($value); |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | $reflection = new \ReflectionClass(__CLASS__); |
45 | 45 | $properties = $reflection->getProperties(\ReflectionProperty::IS_PROTECTED); |
46 | 46 | $data = []; |
47 | - foreach($properties as $property){ |
|
47 | + foreach ($properties as $property) { |
|
48 | 48 | $prop_name = $property->getName(); |
49 | 49 | $method = sprintf('get%s', ucfirst($prop_name)); |
50 | 50 | $form_name = strtolower(preg_replace('/[A-Z]/', '_$0', $prop_name)); |
51 | - if($reflection->hasMethod($method)){ |
|
51 | + if ($reflection->hasMethod($method)) { |
|
52 | 52 | $data[$form_name] = $this->{$method}(); |
53 | 53 | } |
54 | 54 | } |
@@ -25,7 +25,7 @@ |
||
25 | 25 | |
26 | 26 | static function getEntrypoint(): string |
27 | 27 | { |
28 | - return self::ENTRYPOINT.self::VERSION.'/'; |
|
28 | + return self::ENTRYPOINT . self::VERSION . '/'; |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param AccessToken $accessToken |
17 | 17 | * @return CheckoutInterface |
18 | 18 | */ |
19 | - public function create(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface; |
|
19 | + public function create(CheckoutInterface $checkout, AccessToken $accessToken = null): ? CheckoutInterface; |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Retrieve a checkout from sumup.com server |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param AccessToken $accessToken |
26 | 26 | * @return CheckoutInterface |
27 | 27 | */ |
28 | - public function get(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface; |
|
28 | + public function get(CheckoutInterface $checkout, AccessToken $accessToken = null): ? CheckoutInterface; |
|
29 | 29 | |
30 | 30 | /** |
31 | 31 | * Complete a checkout |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param AccessToken $accessToken |
35 | 35 | * @return CheckoutInterface |
36 | 36 | */ |
37 | - public function complete(CheckoutInterface $checkout, AccessToken $accessToken = null):? CheckoutInterface; |
|
37 | + public function complete(CheckoutInterface $checkout, AccessToken $accessToken = null): ? CheckoutInterface; |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Generate body to request a new checkout. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * @inheritDoc |
99 | 99 | */ |
100 | - public function getId():? string { |
|
100 | + public function getId(): ? string { |
|
101 | 101 | return $this->id; |
102 | 102 | } |
103 | 103 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * @inheritDoc |
114 | 114 | */ |
115 | - public function getStatus():? string { |
|
115 | + public function getStatus(): ? string { |
|
116 | 116 | return $this->status; |
117 | 117 | } |
118 | 118 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | /** |
128 | 128 | * @inheritDoc |
129 | 129 | */ |
130 | - public function getAmount():? float { |
|
130 | + public function getAmount(): ? float { |
|
131 | 131 | return $this->amount; |
132 | 132 | } |
133 | 133 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * @inheritDoc |
144 | 144 | */ |
145 | - public function getCurrency():? string { |
|
145 | + public function getCurrency(): ? string { |
|
146 | 146 | return $this->currency; |
147 | 147 | } |
148 | 148 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | /** |
158 | 158 | * @inheritDoc |
159 | 159 | */ |
160 | - public function getPayToEmail():? string { |
|
160 | + public function getPayToEmail(): ? string { |
|
161 | 161 | return $this->payToEmail; |
162 | 162 | } |
163 | 163 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | /** |
173 | 173 | * @inheritDoc |
174 | 174 | */ |
175 | - public function getCheckoutReference():? string { |
|
175 | + public function getCheckoutReference(): ? string { |
|
176 | 176 | return $this->reference; |
177 | 177 | } |
178 | 178 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | /** |
188 | 188 | * @inheritDoc |
189 | 189 | */ |
190 | - public function getDescription():? string { |
|
190 | + public function getDescription(): ? string { |
|
191 | 191 | return $this->description; |
192 | 192 | } |
193 | 193 | |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | /** |
203 | 203 | * @inheritDoc |
204 | 204 | */ |
205 | - public function getFeeAmount():? float { |
|
205 | + public function getFeeAmount(): ? float { |
|
206 | 206 | return $this->feeAmount; |
207 | 207 | } |
208 | 208 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * @inheritDoc |
219 | 219 | */ |
220 | - public function getPayFromEmail():? string { |
|
220 | + public function getPayFromEmail(): ? string { |
|
221 | 221 | return $this->payFromEmail; |
222 | 222 | } |
223 | 223 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * @inheritDoc |
234 | 234 | */ |
235 | - public function getRedirectUrl():? string { |
|
235 | + public function getRedirectUrl(): ? string { |
|
236 | 236 | return $this->redirectUrl; |
237 | 237 | } |
238 | 238 | |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | return $this; |
245 | 245 | } |
246 | 246 | |
247 | - function getValidUntil():? string { |
|
247 | + function getValidUntil(): ? string { |
|
248 | 248 | return $this->validUntil; |
249 | 249 | } |
250 | 250 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | return $this; |
254 | 254 | } |
255 | 255 | |
256 | - function getTransactionCode():? string { |
|
256 | + function getTransactionCode(): ? string { |
|
257 | 257 | return $this->transactionCode; |
258 | 258 | } |
259 | 259 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | return $this; |
263 | 263 | } |
264 | 264 | |
265 | - function getTransactionId():? string { |
|
265 | + function getTransactionId(): ? string { |
|
266 | 266 | return $this->transactionId; |
267 | 267 | } |
268 | 268 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | return $this; |
272 | 272 | } |
273 | 273 | |
274 | - function getTransactions():? array { |
|
274 | + function getTransactions(): ? array { |
|
275 | 275 | // return $this->transactions; |
276 | 276 | //TODO remember myself whats is it. |
277 | 277 | return []; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | return $this; |
284 | 284 | } |
285 | 285 | |
286 | - function getToken():? string { |
|
286 | + function getToken(): ? string { |
|
287 | 287 | return $this->token; |
288 | 288 | } |
289 | 289 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | /** |
367 | 367 | * @return mixed |
368 | 368 | */ |
369 | - public function getType():? string |
|
369 | + public function getType(): ? string |
|
370 | 370 | { |
371 | 371 | return $this->type; |
372 | 372 | } |