for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ElegantMedia\PHPToolkit;
class Reflector
{
/**
* Get the inherited class' directory path.
*
* @param object|string $self
* @param null $pathSuffix
$pathSuffix
null
* @return string
* @throws \ReflectionException
*/
public static function classPath($self, $pathSuffix = null): string
$class = $self;
if (is_object($self)) {
$class = get_class($self);
}
$reflector = new \ReflectionClass($class);
$path = dirname($reflector->getFileName());
if ($pathSuffix) {
false
$path .= DIRECTORY_SEPARATOR . ltrim($pathSuffix, DIRECTORY_SEPARATOR);
return Path::canonical($path);