| Total Complexity | 7 |
| Total Lines | 52 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class IntegerValue extends AbstractValue |
||
| 8 | { |
||
| 9 | private int $value; |
||
| 10 | |||
| 11 | 4 | private function __construct(int $value, bool $cache) |
|
| 17 | } |
||
| 18 | 4 | } |
|
| 19 | |||
| 20 | /** |
||
| 21 | * Creates the value object. |
||
| 22 | * |
||
| 23 | * @param int $value The integer value |
||
| 24 | * @param bool $cache Cache the value so we reuse the same object |
||
| 25 | * |
||
| 26 | * @return IntegerValue The value object |
||
| 27 | */ |
||
| 28 | 6 | public static function create(int $value, bool $cache = false): self |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Exposes the stored integer value. |
||
| 41 | * |
||
| 42 | * @return int The integer value |
||
| 43 | */ |
||
| 44 | 4 | public function getValue(): int |
|
| 45 | { |
||
| 46 | 4 | return $this->value; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Compares if the value of a given object matches with this object. |
||
| 51 | * |
||
| 52 | * @param IntegerValue $object The input object to be compared |
||
| 53 | * |
||
| 54 | * @return bool TRUE if the value matches; FALSE otherwise |
||
| 55 | */ |
||
| 56 | 2 | public function equals(IntegerValue $object): bool |
|
| 59 | } |
||
| 60 | } |
||
| 61 |