| Total Complexity | 7 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | abstract class AbstractIdentification implements IdentificationInterface |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var string|int |
||
| 11 | */ |
||
| 12 | private $identifier; |
||
| 13 | |||
| 14 | private string $identityHash; |
||
| 15 | |||
| 16 | private string $type; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string|int $identifier |
||
| 20 | */ |
||
| 21 | final public function __construct($identifier) |
||
| 32 | } |
||
| 33 | |||
| 34 | final public function getIdentifier() |
||
| 37 | } |
||
| 38 | |||
| 39 | final public function getType(): string |
||
| 42 | } |
||
| 43 | |||
| 44 | final public function equals(IdentificationInterface $identity): bool |
||
| 45 | { |
||
| 46 | return $this->identityHash === self::createIdentityHash($identity); |
||
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param string|int|float $value |
||
| 51 | */ |
||
| 52 | abstract protected function validate($value): void; |
||
| 53 | |||
| 54 | private static function createIdentityHash(IdentificationInterface $identification): string |
||
| 57 | } |
||
| 58 | } |
||
| 59 |