Total Complexity | 6 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | trait HasHiddenAttributes |
||
6 | { |
||
7 | protected $hidden_booted = false; |
||
8 | |||
9 | protected $trait_hidden_attributes = [ |
||
10 | 'trait_hidden_attributes', |
||
11 | 'trait_name_replacements', |
||
12 | |||
13 | 'attribute_name_replacements', |
||
14 | 'unmapped_attributes', |
||
15 | |||
16 | 'hidden_attributes', |
||
17 | 'merge_parent_hidden_attributes', |
||
18 | |||
19 | 'attribute_casting', |
||
20 | 'merge_parent_casting', |
||
21 | ]; |
||
22 | |||
23 | public function mergeHiddenAttributes(array $hidden_attributes, bool $merge_hidden = true) |
||
24 | { |
||
25 | $hidden_attributes = $merge_hidden |
||
26 | ? array_merge($this->getAncestorProperty('hidden_attributes'), $hidden_attributes) |
||
|
|||
27 | : $hidden_attributes; |
||
28 | |||
29 | $this->trait_hidden_attributes = array_merge($this->trait_hidden_attributes, $hidden_attributes); |
||
30 | |||
31 | $this->bootHiddenAttributes(); |
||
32 | |||
33 | return $this; |
||
34 | } |
||
35 | |||
36 | public function getHiddenAttributes() |
||
43 | } |
||
44 | |||
45 | public function isHidden($key): bool |
||
46 | { |
||
47 | return array_key_exists($key, $this->getHiddenAttributes()); |
||
48 | } |
||
49 | |||
50 | protected function bootHiddenAttributes() |
||
55 | } |
||
56 | } |
||
57 |