@@ -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 | { |
@@ -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 | |
@@ -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 | |
@@ -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 | } |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | { |
| 16 | 16 | public function __construct($object, $property, Throwable $previous = null) |
| 17 | 17 | { |
| 18 | - $message = sprintf('Not allowed property %s into %s class!', $property,get_class($object)); |
|
| 18 | + $message = sprintf('Not allowed property %s into %s class!', $property, get_class($object)); |
|
| 19 | 19 | parent::__construct($message, 100, $previous); |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -68,5 +68,5 @@ |
||
| 68 | 68 | /** |
| 69 | 69 | * @return AccessToken |
| 70 | 70 | */ |
| 71 | - function getToken():? AccessToken; |
|
| 71 | + function getToken(): ? AccessToken; |
|
| 72 | 72 | } |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | * @param integer $expiresIn |
| 21 | 21 | * @param string|null $scope |
| 22 | 22 | */ |
| 23 | - function __construct(string $token, string $type, int $expiresIn, string $scope = null){ |
|
| 23 | + function __construct(string $token, string $type, int $expiresIn, string $scope = null) { |
|
| 24 | 24 | $this->token = $token; |
| 25 | 25 | $this->type = $type; |
| 26 | 26 | $this->expiration = time() + $expiresIn; |
| 27 | 27 | |
| 28 | - if($scope !== null) { |
|
| 28 | + if ($scope !== null) { |
|
| 29 | 29 | $this->scope = $scope; |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -86,9 +86,9 @@ discard block |
||
| 86 | 86 | * @param string $scope[,$scope[,$scope[,...]]] |
| 87 | 87 | * @return boolean |
| 88 | 88 | */ |
| 89 | - function canAccess(string $scope){ |
|
| 89 | + function canAccess(string $scope) { |
|
| 90 | 90 | $scopes = func_get_args(); |
| 91 | 91 | $diff = array_diff($scopes, $this->scope); |
| 92 | - return count($diff)>0; |
|
| 92 | + return count($diff) > 0; |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function getToken():? string |
|
| 61 | + public function getToken(): ? string |
|
| 62 | 62 | { |
| 63 | 63 | return $this->token; |
| 64 | 64 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * |
| 83 | 83 | * @return bool |
| 84 | 84 | */ |
| 85 | - public function getActive():? bool |
|
| 85 | + public function getActive(): ? bool |
|
| 86 | 86 | { |
| 87 | 87 | return $this->active; |
| 88 | 88 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return string |
| 108 | 108 | */ |
| 109 | - public function getType():? string |
|
| 109 | + public function getType(): ? string |
|
| 110 | 110 | { |
| 111 | 111 | return $this->type; |
| 112 | 112 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @return string |
| 132 | 132 | */ |
| 133 | - public function getLast4Digits():? string |
|
| 133 | + public function getLast4Digits(): ? string |
|
| 134 | 134 | { |
| 135 | 135 | return $this->last4Digits; |
| 136 | 136 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @return string |
| 156 | 156 | */ |
| 157 | - public function getCardType():? string |
|
| 157 | + public function getCardType(): ? string |
|
| 158 | 158 | { |
| 159 | 159 | return $this->cardSchema; |
| 160 | 160 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @see http://docs.sumup.com/rest-api/checkouts-api/#customers-payment-instruments-post |
| 184 | 184 | * @return array |
| 185 | 185 | */ |
| 186 | - public function getCard():? array |
|
| 186 | + public function getCard(): ? array |
|
| 187 | 187 | { |
| 188 | 188 | return [ |
| 189 | 189 | 'last_4_digits' => $this->getLast4Digits(), |