Total Complexity | 8 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
5 | trait HasNames |
||
6 | { |
||
7 | /** |
||
8 | * @property-read $input_name |
||
9 | * |
||
10 | * @return mixed|string |
||
11 | */ |
||
12 | public function getInputNameAttribute() { |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @property-read $input_name |
||
26 | * |
||
27 | * @return mixed|string |
||
28 | */ |
||
29 | public function getInputJsonNameAttribute() { |
||
30 | if ($this->isRepeating) { |
||
31 | return $this->parent()->input_name . '[' . $this->key . '][' . $this->content()['name'] . ']'; |
||
32 | } |
||
33 | |||
34 | if ($this->inFieldSet) { |
||
35 | return $this->parent()->name . '[' . $this->content()['name'] . ']'; |
||
36 | } |
||
37 | |||
38 | return $this->content()['name']; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * @property-read $input_dot_name |
||
43 | * |
||
44 | * @return mixed|string |
||
45 | */ |
||
46 | public function getInputDotNameAttribute() { |
||
47 | return str_replace([ |
||
48 | '[]', |
||
49 | '[', |
||
50 | ']' |
||
51 | ], [ |
||
52 | '.*', |
||
53 | '.', |
||
54 | '' |
||
55 | ], $this->input_name); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @property-read $input_dot_name |
||
60 | * |
||
61 | * @return mixed|string |
||
62 | */ |
||
63 | public function getInputJsonDotNameAttribute() { |
||
73 | } |
||
74 | } |