Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/http-kernel/Config/FileLocator.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 1fec387a4317 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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 $kernel; | |
25 private $path; | |
26 | |
27 /** | |
28 * Constructor. | |
29 * | |
30 * @param KernelInterface $kernel A KernelInterface instance | |
31 * @param null|string $path The path the global resource directory | |
32 * @param array $paths An array of paths where to look for resources | |
33 */ | |
34 public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) | |
35 { | |
36 $this->kernel = $kernel; | |
37 if (null !== $path) { | |
38 $this->path = $path; | |
39 $paths[] = $path; | |
40 } | |
41 | |
42 parent::__construct($paths); | |
43 } | |
44 | |
45 /** | |
46 * {@inheritdoc} | |
47 */ | |
48 public function locate($file, $currentPath = null, $first = true) | |
49 { | |
50 if (isset($file[0]) && '@' === $file[0]) { | |
51 return $this->kernel->locateResource($file, $this->path, $first); | |
52 } | |
53 | |
54 return parent::locate($file, $currentPath, $first); | |
55 } | |
56 } |