Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
UnaryNotSpecification
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getSqlTemplate
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 evaluateUnary
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 Phexium\Domain\Specification;
11
12use Override;
13
14// Use case: Find all books except those with "draft" status
15// $spec = new UnaryNotSpecification($isDraft);
16final readonly class UnaryNotSpecification extends UnaryAbstract
17{
18    #[Override]
19    protected function getSqlTemplate(): string
20    {
21        return 'NOT (SPEC)';
22    }
23
24    #[Override]
25    protected function evaluateUnary(callable $filter, array $row): bool
26    {
27        return !$filter($row);
28    }
29}