for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Micro framework package.
*
* (c) Stanislau Komar <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Micro\Plugin\Configuration\Helper\Business\Path;
use Micro\Plugin\Configuration\Helper\Business\Plugin\PluginClassResolverInterface;
class PathResolver implements PathResolverInterface
{
public function __construct(private readonly PluginClassResolverInterface $pluginClassResolver)
}
public function resolve(string $relative): string
if (!str_starts_with($relative, '@')) {
return $relative;
$alias = explode(\DIRECTORY_SEPARATOR, $relative);
$plugin = $this->pluginClassResolver->resolve(ltrim($alias[0], '@'));
$reflection = new \ReflectionClass($plugin);
$file = $reflection->getFileName();
if (false === $file) {
$basePath = \dirname($file);
$alias[0] = $basePath;
return implode(\DIRECTORY_SEPARATOR, $alias);