1 | <?php |
||
13 | class Tools |
||
14 | { |
||
15 | |||
16 | /** |
||
17 | * @param string $namespace |
||
18 | * @param string $mandatoryFirstBackslash |
||
19 | * @return boolean |
||
20 | */ |
||
21 | public static function isNamespaceValid($namespace, $mandatoryFirstBackslash = true) |
||
52 | |||
53 | /** |
||
54 | * @param string $name |
||
55 | * @return boolean |
||
56 | */ |
||
57 | public static function isValidPropertyNameString($name) |
||
81 | |||
82 | /** |
||
83 | * @param string $type |
||
84 | * @return boolean |
||
85 | */ |
||
86 | public static function isValidPropertyTypeString($type) |
||
101 | |||
102 | /** |
||
103 | * @param string $namespace |
||
104 | * @return string |
||
105 | * @throws Exception |
||
106 | */ |
||
107 | public static function getNamespaceWithoutName($namespace) |
||
114 | |||
115 | /** |
||
116 | * @param string $namespace |
||
117 | * @return string |
||
118 | * @throws Exception |
||
119 | */ |
||
120 | public static function getDirectoryFromNamespace($namespace) |
||
125 | |||
126 | /** |
||
127 | * @param string $namespace |
||
128 | * @return string |
||
129 | * @throws Exception |
||
130 | */ |
||
131 | public static function getNameFromNamespace($namespace) |
||
137 | |||
138 | /** |
||
139 | * @param string $namespace |
||
140 | * @return string |
||
141 | */ |
||
142 | public static function removeBackslashPrefixFromNamespace($namespace) |
||
150 | |||
151 | /** |
||
152 | * Throw Exception when namespace invalid |
||
153 | * |
||
154 | * @param string $namespace |
||
155 | * @throws Exception |
||
156 | */ |
||
157 | public static function checkNamespaceValid($namespace) |
||
163 | |||
164 | /** |
||
165 | * @param string $string |
||
166 | * @return array |
||
167 | * @throws Exception |
||
168 | */ |
||
169 | public static function explodeTemplateStringToArray($string) |
||
177 | |||
178 | /** |
||
179 | * @param array $array |
||
180 | * @return string |
||
181 | * @throws Exception |
||
182 | */ |
||
183 | public static function implodeArrayToTemplate($array) |
||
191 | |||
192 | /** |
||
193 | * Check existance of constraint |
||
194 | * proper annotation eg. @\Symfony\Component\Validator\Constraints\Valid() |
||
195 | * |
||
196 | * @param string $constraintAnnotation |
||
197 | * @return boolean |
||
198 | */ |
||
199 | public static function isCallableConstraintAnnotation($constraintAnnotation) |
||
213 | |||
214 | /** |
||
215 | * If first character of string is backslash then return true |
||
216 | * |
||
217 | * @param string $string |
||
218 | * @return boolean |
||
219 | * @throws Exception |
||
220 | */ |
||
221 | public static function isFirstCharBackslash($string) |
||
229 | } |
||
230 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.