Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
EmailSpecification
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
3 / 3
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toSql
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
 toInMemoryFilter
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace AppDemo\User\Domain\Specification;
11
12use AppDemo\User\Domain\Email;
13use Phexium\Domain\Specification\SpecificationInterface;
14
15final readonly class EmailSpecification implements SpecificationInterface
16{
17    public function __construct(
18        private Email $email
19    ) {}
20
21    public function toSql(): array
22    {
23        return [
24            'sql' => 'email = :email',
25            'params' => ['email' => $this->email->getValue()],
26        ];
27    }
28
29    public function toInMemoryFilter(): callable
30    {
31        return fn (array $row): bool => $row['email'] === $this->email->getValue();
32    }
33}