Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace Symfony\Component\HttpKernel\Config; Chris@0: Chris@0: use Symfony\Component\Config\FileLocator as BaseFileLocator; Chris@0: use Symfony\Component\HttpKernel\KernelInterface; Chris@0: Chris@0: /** Chris@0: * FileLocator uses the KernelInterface to locate resources in bundles. Chris@0: * Chris@0: * @author Fabien Potencier Chris@0: */ Chris@0: class FileLocator extends BaseFileLocator Chris@0: { Chris@0: private $kernel; Chris@0: private $path; Chris@0: Chris@0: /** Chris@0: * @param KernelInterface $kernel A KernelInterface instance Chris@17: * @param string|null $path The path the global resource directory Chris@0: * @param array $paths An array of paths where to look for resources Chris@0: */ Chris@17: public function __construct(KernelInterface $kernel, $path = null, array $paths = []) Chris@0: { Chris@0: $this->kernel = $kernel; Chris@0: if (null !== $path) { Chris@0: $this->path = $path; Chris@0: $paths[] = $path; Chris@0: } Chris@0: Chris@0: parent::__construct($paths); Chris@0: } Chris@0: Chris@0: /** Chris@0: * {@inheritdoc} Chris@0: */ Chris@0: public function locate($file, $currentPath = null, $first = true) Chris@0: { Chris@0: if (isset($file[0]) && '@' === $file[0]) { Chris@0: return $this->kernel->locateResource($file, $this->path, $first); Chris@0: } Chris@0: Chris@0: return parent::locate($file, $currentPath, $first); Chris@0: } Chris@0: }