@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | namespace Thunder\Currenz; |
4 | 4 | |
5 | 5 | use Prophecy\Exception\InvalidArgumentException; |
@@ -14,24 +14,24 @@ discard block |
||
14 | 14 | |
15 | 15 | public function __construct(string $name, string $code, ?int $digits, array $countries, string $number) |
16 | 16 | { |
17 | - if(empty($name)) { |
|
17 | + if (empty($name)) { |
|
18 | 18 | throw new \InvalidArgumentException('Currency name must not be empty!'); |
19 | 19 | } |
20 | - if(!preg_match('~^[A-Z]{3}$~', $code)) { |
|
20 | + if (!preg_match('~^[A-Z]{3}$~', $code)) { |
|
21 | 21 | throw new \InvalidArgumentException(sprintf('ISO4217 currency code must be an uppercase three-letter string, `%s` given!', $code)); |
22 | 22 | } |
23 | - if($digits !== null && $digits < 0) { |
|
23 | + if ($digits !== null && $digits < 0) { |
|
24 | 24 | throw new \InvalidArgumentException(sprintf('Currency digits must be a non-negative integer or null, `%s` given!', $digits)); |
25 | 25 | } |
26 | - foreach($countries as $country) { |
|
27 | - if(false === is_string($country)) { |
|
26 | + foreach ($countries as $country) { |
|
27 | + if (false === is_string($country)) { |
|
28 | 28 | throw new InvalidArgumentException('Currency country name must be a string!'); |
29 | 29 | } |
30 | - if(empty($country)) { |
|
30 | + if (empty($country)) { |
|
31 | 31 | throw new \InvalidArgumentException('Currency country name must not be empty!'); |
32 | 32 | } |
33 | 33 | } |
34 | - if(!preg_match('~^[0-9]{3}$~', $number)) { |
|
34 | + if (!preg_match('~^[0-9]{3}$~', $number)) { |
|
35 | 35 | throw new \InvalidArgumentException(sprintf('ISO4217 currency number must be a three-digit string, `%s` given!', $number)); |
36 | 36 | } |
37 | 37 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | public function getUnits(): int |
61 | 61 | { |
62 | - if(null === $this->digits) { |
|
62 | + if (null === $this->digits) { |
|
63 | 63 | return 0; |
64 | 64 | } |
65 | 65 |