Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| Not | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| applies | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | namespace Apie\Core\Attributes; |
| 3 | |
| 4 | use Apie\Core\Context\ApieContext; |
| 5 | use Attribute; |
| 6 | |
| 7 | /** |
| 8 | * Add this attribute to add a negative check. |
| 9 | */ |
| 10 | #[Attribute(Attribute::IS_REPEATABLE|Attribute::TARGET_CLASS|Attribute::TARGET_METHOD|Attribute::TARGET_PROPERTY|Attribute::TARGET_PARAMETER|Attribute::TARGET_CLASS_CONSTANT)] |
| 11 | final class Not implements ApieContextAttribute |
| 12 | { |
| 13 | public function __construct(private ApieContextAttribute $check) |
| 14 | { |
| 15 | } |
| 16 | |
| 17 | public function applies(ApieContext $context): bool |
| 18 | { |
| 19 | return !$this->check->applies($context); |
| 20 | } |
| 21 | } |