Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| BinaryNandSpecification | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
1 / 1 |
| getSqlTemplate | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| evaluateBinary | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | // ╔════════════════════════════════════════════════════════════╗ |
| 4 | // ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║ |
| 5 | // ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com> ║ |
| 6 | // ╚════════════════════════════════════════════════════════════╝ |
| 7 | |
| 8 | declare(strict_types=1); |
| 9 | |
| 10 | namespace Phexium\Domain\Specification; |
| 11 | |
| 12 | use Override; |
| 13 | |
| 14 | // Use case: Book is not both expired AND deleted |
| 15 | // $spec = new BinaryNandSpecification($isExpired, $isDeleted); |
| 16 | final readonly class BinaryNandSpecification extends BinaryAbstract |
| 17 | { |
| 18 | #[Override] |
| 19 | protected function getSqlTemplate(): string |
| 20 | { |
| 21 | return 'NOT ((LEFT) AND (RIGHT))'; |
| 22 | } |
| 23 | |
| 24 | #[Override] |
| 25 | protected function evaluateBinary( |
| 26 | callable $leftFilter, |
| 27 | callable $rightFilter, |
| 28 | array $row |
| 29 | ): bool { |
| 30 | return !($leftFilter($row) && $rightFilter($row)); |
| 31 | } |
| 32 | } |