Total Complexity | 4 |
Total Lines | 24 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | trait BelongsToField |
||
7 | { |
||
8 | private ?string $field = null; |
||
9 | |||
10 | public function getField(): ?string |
||
11 | { |
||
12 | return $this->field; |
||
13 | } |
||
14 | |||
15 | public function withField(?string $field = null): static |
||
16 | { |
||
17 | $instance = clone $this; |
||
18 | $instance->setField($field); |
||
19 | return $instance; |
||
20 | } |
||
21 | |||
22 | protected function setField(?string $field): void |
||
23 | { |
||
24 | $this->field = $field; |
||
25 | } |
||
26 | |||
27 | public function belongsToField(): bool |
||
30 | } |
||
31 | } |
||
32 |