1 | <?php |
||
10 | trait AccessorTrait |
||
11 | { |
||
12 | public static $typeSnakeCase = 0; |
||
13 | public static $typeCamelCase = 1; |
||
14 | |||
15 | /** |
||
16 | * @var int Set default type to snake case |
||
17 | */ |
||
18 | private $type = 0; |
||
19 | |||
20 | private $container = []; |
||
21 | |||
22 | /** |
||
23 | * @param $methodName string Key |
||
24 | * @param $args array Method Arguments |
||
25 | * |
||
26 | * @return mixed |
||
27 | */ |
||
28 | public function __call($methodName, $args) |
||
58 | |||
59 | /** |
||
60 | * @param $property string Key |
||
61 | * |
||
62 | * @return mixed |
||
63 | */ |
||
64 | public function get($property) |
||
72 | |||
73 | /** |
||
74 | * @param $property |
||
75 | * |
||
76 | * @return bool|null |
||
77 | */ |
||
78 | public function is($property) |
||
86 | |||
87 | /** |
||
88 | * @param $property string Key |
||
89 | * @param $value string Value |
||
90 | * |
||
91 | * @return self |
||
92 | */ |
||
93 | public function set($property, $value) |
||
106 | |||
107 | /** |
||
108 | * Check if args are valid or not. |
||
109 | * |
||
110 | * @param array $args List of arguments |
||
111 | * @param int $min integer Minimum valid params |
||
112 | * @param int $max Maximum valid params |
||
113 | * @param string $methodName Method name |
||
114 | */ |
||
115 | protected function checkArguments(array $args, $min, $max, $methodName) |
||
122 | |||
123 | /** |
||
124 | * @return array |
||
125 | */ |
||
126 | public function getContainer() |
||
130 | |||
131 | /** |
||
132 | * @return int |
||
133 | */ |
||
134 | public function getType() |
||
138 | |||
139 | /** |
||
140 | * @param int $type |
||
141 | * |
||
142 | * @return $this |
||
143 | */ |
||
144 | public function setType($type) |
||
150 | } |
||
151 |