| Total Complexity | 5 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class Classes |
||
| 8 | { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @param string $class |
||
| 12 | * |
||
| 13 | * @return string |
||
| 14 | * @throws \ReflectionException |
||
| 15 | */ |
||
| 16 | public static function getName(string $class): string |
||
| 17 | { |
||
| 18 | $ref = new \ReflectionClass($class); |
||
| 19 | |||
| 20 | return (string) $ref->getShortName(); |
||
| 21 | } |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param $object |
||
| 25 | * |
||
| 26 | * @return string |
||
| 27 | * @throws \ReflectionException |
||
| 28 | */ |
||
| 29 | public static function getObjectName($object): string |
||
| 30 | { |
||
| 31 | $ref = new \ReflectionClass($object); |
||
| 32 | |||
| 33 | return (string) $ref->getShortName(); |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $str |
||
| 38 | * @param string $postfix |
||
| 39 | * |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | public static function cutEntity(string $str, string $postfix) |
||
| 43 | { |
||
| 44 | return substr($str, 0, strpos($str, $postfix)); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $entity |
||
| 49 | * @return string |
||
| 50 | */ |
||
| 51 | public static function getModelEntity(string $entity): string |
||
| 52 | { |
||
| 53 | return DirsInterface::MODULES_DIR . PhpInterface::BACKSLASH . ConfigHelper::getModuleName() . |
||
| 54 | PhpInterface::BACKSLASH . DirsInterface::ENTITIES_DIR . |
||
| 55 | PhpInterface::BACKSLASH . $entity; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Gets class name ucwording 1st and replacing -_ in composite names |
||
| 60 | * @param string $objectName |
||
| 61 | * |
||
| 62 | * @return string |
||
| 63 | */ |
||
| 64 | public static function getClassName(string $objectName): string |
||
| 72 | ) |
||
| 73 | ); |
||
| 74 | } |
||
| 75 | } |