Lines
100.00%
1 / 1
Functions and Methods
100.00%
1 / 1
Classes and Traits
100.00%
1 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| WriteHook | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | 100.00% | 1 / 1 | |||
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace BlueprintAU\Radiant\Attributes; | |
| 6 | ||
| 7 | /** | |
| 8 | * Marks a trait method as a write-path hook. | |
| 9 | * | |
| 10 | * The method name is arbitrary — two traits on one class never collide. | |
| 11 | * The claim contract: a `null` return is an observer (dispatch | |
| 12 | * continues); a `bool` return claims the write (`true` = performed and | |
| 13 | * succeeded, `false` = owned and failed/refused) and ends dispatch. | |
| 14 | * `Hook::Destroy` observers must return void — the hard DELETE itself | |
| 15 | * is unclaimable. | |
| 16 | */ | |
| 17 | #[\Attribute(\Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] | |
| 18 | final class WriteHook | |
| 19 | { | |
| 20 | /** | |
| 21 | * Create a write-hook declaration. | |
| 22 | * | |
| 23 | * @param Hook $hook | |
| 24 | */ | |
| 25 | final public function __construct( | |
| 26 | public Hook $hook, | |
| 27 | ) { | |
| 28 | } | |
| 29 | } |