for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace ProxyManager\Autoloader;
use ProxyManager\FileLocator\FileLocatorInterface;
use ProxyManager\Inflector\ClassNameInflectorInterface;
/**
* {@inheritDoc}
*
* @author Marco Pivetta <[email protected]>
* @license MIT
*/
class Autoloader implements AutoloaderInterface
{
* @var \ProxyManager\FileLocator\FileLocatorInterface
protected $fileLocator;
* @var \ProxyManager\Inflector\ClassNameInflectorInterface
protected $classNameInflector;
* @param \ProxyManager\FileLocator\FileLocatorInterface $fileLocator
* @param \ProxyManager\Inflector\ClassNameInflectorInterface $classNameInflector
public function __construct(FileLocatorInterface $fileLocator, ClassNameInflectorInterface $classNameInflector)
$this->fileLocator = $fileLocator;
$this->classNameInflector = $classNameInflector;
}
public function __invoke(string $className) : bool
if (class_exists($className, false) || ! $this->classNameInflector->isProxyClassName($className)) {
return false;
$file = $this->fileLocator->getProxyFileName($className);
if (! file_exists($file)) {
/* @noinspection PhpIncludeInspection */
/* @noinspection UsingInclusionOnceReturnValueInspection */
return (bool) require_once $file;