FileLocator.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace Matomo\Dependencies\Symfony\Component\HttpKernel\Config; |
| 12 | |
| 13 | use Symfony\Component\Config\FileLocator as BaseFileLocator; |
| 14 | use Matomo\Dependencies\Symfony\Component\HttpKernel\KernelInterface; |
| 15 | /** |
| 16 | * FileLocator uses the KernelInterface to locate resources in bundles. |
| 17 | * |
| 18 | * @author Fabien Potencier <fabien@symfony.com> |
| 19 | */ |
| 20 | class FileLocator extends BaseFileLocator |
| 21 | { |
| 22 | private $kernel; |
| 23 | public function __construct(KernelInterface $kernel) |
| 24 | { |
| 25 | $this->kernel = $kernel; |
| 26 | parent::__construct(); |
| 27 | } |
| 28 | /** |
| 29 | * {@inheritdoc} |
| 30 | */ |
| 31 | public function locate(string $file, ?string $currentPath = null, bool $first = \true) |
| 32 | { |
| 33 | if (isset($file[0]) && '@' === $file[0]) { |
| 34 | $resource = $this->kernel->locateResource($file); |
| 35 | return $first ? $resource : [$resource]; |
| 36 | } |
| 37 | return parent::locate($file, $currentPath, $first); |
| 38 | } |
| 39 | } |
| 40 |