@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Euro; |
| 6 | 6 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * @param int $cents |
| 22 | 22 | * @throws InvalidArgumentException |
| 23 | 23 | */ |
| 24 | - private function __construct( int $cents ) { |
|
| 25 | - if ( $cents < 0 ) { |
|
| 26 | - throw new InvalidArgumentException( 'Amount needs to be positive' ); |
|
| 24 | + private function __construct(int $cents) { |
|
| 25 | + if ($cents < 0) { |
|
| 26 | + throw new InvalidArgumentException('Amount needs to be positive'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $this->cents = $cents; |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @return self |
| 35 | 35 | * @throws InvalidArgumentException |
| 36 | 36 | */ |
| 37 | - public static function newFromCents( int $cents ): self { |
|
| 38 | - return new self( $cents ); |
|
| 37 | + public static function newFromCents(int $cents): self { |
|
| 38 | + return new self($cents); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | * @return self |
| 50 | 50 | * @throws InvalidArgumentException |
| 51 | 51 | */ |
| 52 | - public static function newFromString( string $euroAmount ): self { |
|
| 53 | - if ( !is_numeric( $euroAmount ) ) { |
|
| 54 | - throw new InvalidArgumentException( 'Not a number' ); |
|
| 52 | + public static function newFromString(string $euroAmount): self { |
|
| 53 | + if (!is_numeric($euroAmount)) { |
|
| 54 | + throw new InvalidArgumentException('Not a number'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return new self( intval( |
|
| 58 | - round( $euroAmount, self::$DECIMAL_COUNT ) * self::$CENTS_PER_EURO |
|
| 59 | - ) ); |
|
| 57 | + return new self(intval( |
|
| 58 | + round($euroAmount, self::$DECIMAL_COUNT) * self::$CENTS_PER_EURO |
|
| 59 | + )); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * @return self |
| 69 | 69 | * @throws InvalidArgumentException |
| 70 | 70 | */ |
| 71 | - public static function newFromFloat( float $euroAmount ) { |
|
| 72 | - return new self( intval( |
|
| 73 | - round( $euroAmount, self::$DECIMAL_COUNT ) * self::$CENTS_PER_EURO |
|
| 74 | - ) ); |
|
| 71 | + public static function newFromFloat(float $euroAmount) { |
|
| 72 | + return new self(intval( |
|
| 73 | + round($euroAmount, self::$DECIMAL_COUNT) * self::$CENTS_PER_EURO |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * @return self |
| 80 | 80 | * @throws InvalidArgumentException |
| 81 | 81 | */ |
| 82 | - public static function newFromInt( int $euroAmount ) { |
|
| 83 | - return new self( $euroAmount * self::$CENTS_PER_EURO ); |
|
| 82 | + public static function newFromInt(int $euroAmount) { |
|
| 83 | + return new self($euroAmount * self::$CENTS_PER_EURO); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function getEuroCents(): int { |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * Returns the euro amount as string with two decimals always present in format "42.00". |
| 96 | 96 | */ |
| 97 | 97 | public function getEuroString(): string { |
| 98 | - return number_format( $this->getEuroFloat(), self::$DECIMAL_COUNT, '.', '' ); |
|
| 98 | + return number_format($this->getEuroFloat(), self::$DECIMAL_COUNT, '.', ''); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function equals( Euro $euro ): bool { |
|
| 101 | + public function equals(Euro $euro): bool { |
|
| 102 | 102 | return $this->cents === $euro->cents; |
| 103 | 103 | } |
| 104 | 104 | |