Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
16 | public static function shortName($objectOrNamespace) |
||
17 | { |
||
18 | if (is_object($objectOrNamespace)) { |
||
19 | $objectOrNamespace = get_class($objectOrNamespace); |
||
20 | } elseif (!class_exists($objectOrNamespace)) { |
||
21 | throw new InvalidArgumentException( |
||
22 | sprintf( |
||
23 | 'There is no class named %s', |
||
24 | $objectOrNamespace |
||
25 | ) |
||
26 | ); |
||
27 | } |
||
28 | |||
29 | $classNameWithNamespace = explode('\\', $objectOrNamespace); |
||
30 | |||
31 | return end($classNameWithNamespace); |
||
32 | } |
||
33 | } |
||
34 |