| Total Complexity | 8 |
| Total Lines | 39 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class MutatorContext |
||
| 13 | { |
||
| 14 | public Model $target; |
||
| 15 | public string $attribute; |
||
| 16 | public ?SchemaAttribute $attributeSchema; |
||
| 17 | |||
| 18 | public function __construct(Model $target, string $attribute, ?SchemaAttribute $attributeSchema = null) |
||
| 23 | } |
||
| 24 | |||
| 25 | public function raise(?string $message = null): void |
||
| 26 | { |
||
| 27 | $attributeAbsoluteName = $this->getAttributeAbsoluteName(); |
||
| 28 | throw new MutatorAttributeException($attributeAbsoluteName, $message); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function assert($conditional, ?string $message = null): void |
||
| 32 | { |
||
| 33 | if (!$conditional) { |
||
| 34 | $this->raise($message); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | public function getAttributeRelativeName(): string |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getAttributeAbsoluteName(): string |
||
| 46 | } |
||
| 47 | |||
| 48 | public static function from(Model $target, string $attribute, ?SchemaAttribute $attributeSchema = null): self |
||
| 51 | } |
||
| 52 | } |