1 | <?php |
||
7 | class Utils |
||
8 | { |
||
9 | /** |
||
10 | * Convert snake_case to CamelCase |
||
11 | * |
||
12 | * @param string $string |
||
13 | * |
||
14 | * @return string |
||
15 | */ |
||
16 | public static function snakeToCamelCase($string) |
||
20 | |||
21 | /** |
||
22 | * Convert dashed-case to CamelCase |
||
23 | * |
||
24 | * @param string $string |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | public static function dashedToCamelCase($string) |
||
32 | |||
33 | /** |
||
34 | * Convert a camel cased Object into a CamelCasedObject |
||
35 | * |
||
36 | * @param string $string |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | public static function camelCaseSpaced($string) |
||
44 | |||
45 | /** |
||
46 | * Convert a CamelCasedObject into a dashed-case-object |
||
47 | * |
||
48 | * @param string $string |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public static function camelTodashed($string) |
||
58 | |||
59 | /** |
||
60 | * Convert a /Namespaced/Class to a dashed-class |
||
61 | * |
||
62 | * @param string $string |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public static function namespacedClassToDashed($string) |
||
72 | |||
73 | /** |
||
74 | * Convert a /Namespaced/Class to a dashed-class |
||
75 | * |
||
76 | * @param string $string |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public static function namespaceFromClass($string) |
||
88 | |||
89 | /** |
||
90 | * @return string |
||
91 | */ |
||
92 | public static function className() |
||
105 | |||
106 | /** |
||
107 | * @param string|object $input |
||
108 | * |
||
109 | * @return array |
||
110 | */ |
||
111 | public static function explodeClass($input) |
||
119 | |||
120 | /** |
||
121 | * @param array $class |
||
122 | * |
||
123 | * @return array Class Name, Salt and Namespace |
||
124 | */ |
||
125 | public static function extractFromClass($class) |
||
135 | |||
136 | /** |
||
137 | * Read a JSON file and return its content |
||
138 | * |
||
139 | * @param string $path Path to read from |
||
140 | * @param bool $associative Convert objects to associative arrays |
||
141 | * |
||
142 | * @return mixed |
||
143 | */ |
||
144 | public static function getJSON($path, $associative = false) |
||
148 | |||
149 | /** |
||
150 | * Store any data as JSON to a file |
||
151 | * |
||
152 | * @param string $path Path to where the file should be stored |
||
153 | * @param string $content Content to be stored |
||
154 | * |
||
155 | * @return int |
||
156 | */ |
||
157 | public static function storeJSON($path, $content) |
||
170 | } |
||
171 |