Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| HashedPassword | |
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
4 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
2 | |||
| __toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| value | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace App\Identity\Domain\ValueObject; |
| 6 | |
| 7 | use InvalidArgumentException; |
| 8 | |
| 9 | /** |
| 10 | * Wraps an already-hashed password. Hashing itself is an infrastructure concern. |
| 11 | */ |
| 12 | final class HashedPassword |
| 13 | { |
| 14 | public function __construct(private readonly string $value) |
| 15 | { |
| 16 | if ($value === '') { |
| 17 | throw new InvalidArgumentException('Hashed password cannot be empty.'); |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | public function __toString(): string |
| 22 | { |
| 23 | return $this->value; |
| 24 | } |
| 25 | |
| 26 | public function value(): string |
| 27 | { |
| 28 | return $this->value; |
| 29 | } |
| 30 | } |