1 | <?php |
||
14 | trait ConvertsToSnakeCase |
||
15 | { |
||
16 | /** |
||
17 | * Check if an input element is set on the request. |
||
18 | * |
||
19 | * @param string $key |
||
20 | * @return bool |
||
21 | */ |
||
22 | public function __isset( $key ) |
||
26 | |||
27 | /** |
||
28 | * Get an input element from the request. |
||
29 | * |
||
30 | * @param string $key |
||
31 | * @return mixed |
||
32 | */ |
||
33 | public function __get( $key ) |
||
37 | |||
38 | /** |
||
39 | * Get the validator instance for the request. |
||
40 | * |
||
41 | * @return \Illuminate\Contracts\Validation\Validator |
||
42 | */ |
||
43 | protected function getValidatorInstance() |
||
49 | |||
50 | /** |
||
51 | * Cast and convert parameters. |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | protected function getConvertedParameters():array |
||
63 | |||
64 | /** |
||
65 | * Cast all string booleans to real boolean values. |
||
66 | * |
||
67 | * @param mixed $input |
||
68 | * @return array |
||
69 | */ |
||
70 | protected function castBooleans( $input ):array |
||
84 | |||
85 | /** |
||
86 | * Cast a given value to a boolean if it is in fact a boolean. |
||
87 | * |
||
88 | * @param mixed $value |
||
89 | * @return mixed |
||
90 | */ |
||
91 | protected function castValueToBoolean( $value ):array |
||
99 | |||
100 | /** |
||
101 | * Convert a string or array to snake case. |
||
102 | * |
||
103 | * @param mixed $input |
||
104 | * @return mixed |
||
105 | */ |
||
106 | protected function convertToSnakeCase( $input ) |
||
116 | |||
117 | /** |
||
118 | * Convert all keys of an array to snake case. |
||
119 | * |
||
120 | * @param array $input |
||
121 | * @return array |
||
122 | */ |
||
123 | protected function convertArrayToSnakeCase( array $input ):array |
||
133 | |||
134 | /** |
||
135 | * Get all of the input and files for the request. |
||
136 | * |
||
137 | * @return array |
||
138 | */ |
||
139 | abstract public function all(); |
||
140 | |||
141 | /** |
||
142 | * Get the input source for the request. |
||
143 | * |
||
144 | * @return \Symfony\Component\HttpFoundation\ParameterBag |
||
145 | */ |
||
146 | abstract protected function getInputSource(); |
||
147 | } |