1: <?php
2: 3: 4: 5: 6:
7: namespace utils;
8:
9: 10: 11: 12: 13:
14: class Parser {
15:
16: 17: 18: 19: 20: 21:
22: static function parseClassName($name) {
23: if (!is_array($name) && !empty($name)) {
24: $sliceExploded = explode('\\', $name);
25:
26: $len = count($sliceExploded);
27: $last = $len - 1;
28:
29: $array = array('className' => $sliceExploded[$last], 'namespace' => null);
30:
31: if($len > 1) {
32: $array['namespace'] = array_slice($sliceExploded, 0, -1);
33: }
34:
35: return $array;
36: } else {
37: throw new ParserException("Bad class name: [$name]");
38: }
39: }
40: }
41: