for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SoliDry\Helpers;
use SoliDry\Types\DirsInterface;
use SoliDry\Types\PhpInterface;
class Classes
{
/**
* @param string $class
*
* @return string
* @throws \ReflectionException
*/
public static function getName(string $class): string
$ref = new \ReflectionClass($class);
return (string) $ref->getShortName();
}
* @param $object
public static function getObjectName($object): string
$ref = new \ReflectionClass($object);
* @param string $str
* @param string $postfix
* @return mixed
public static function cutEntity(string $str, string $postfix)
return substr($str, 0, strpos($str, $postfix));
* @param string $entity
public static function getModelEntity(string $entity): string
return DirsInterface::MODULES_DIR . PhpInterface::BACKSLASH . ConfigHelper::getModuleName() .
PhpInterface::BACKSLASH . DirsInterface::ENTITIES_DIR .
PhpInterface::BACKSLASH . $entity;
* Gets class name ucwording 1st and replacing -_ in composite names
* @param string $objectName
public static function getClassName(string $objectName): string
return str_replace(
[
PhpInterface::DASH,
PhpInterface::UNDERSCORE
], '', ucwords(
$objectName, PhpInterface::DASH . PhpInterface::UNDERSCORE
)
);