Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
 
12
namespace Symfony\Component\HttpKernel\Config;
13
 
14
use Symfony\Component\Config\FileLocator as BaseFileLocator;
15
use Symfony\Component\HttpKernel\KernelInterface;
16
 
17
/**
18
 * FileLocator uses the KernelInterface to locate resources in bundles.
19
 *
20
 * @author Fabien Potencier <fabien@symfony.com>
21
 */
22
class FileLocator extends BaseFileLocator
23
{
24
    private KernelInterface $kernel;
25
 
26
    public function __construct(KernelInterface $kernel)
27
    {
28
        $this->kernel = $kernel;
29
 
30
        parent::__construct();
31
    }
32
 
33
    public function locate(string $file, string $currentPath = null, bool $first = true): string|array
34
    {
35
        if (isset($file[0]) && '@' === $file[0]) {
36
            $resource = $this->kernel->locateResource($file);
37
 
38
            return $first ? $resource : [$resource];
39
        }
40
 
41
        return parent::locate($file, $currentPath, $first);
42
    }
43
}