4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\DependencyInjection\Loader;
14 use Symfony\Component\Config\Resource\FileResource;
17 * PhpFileLoader loads service definitions from a PHP file.
19 * The PHP file is required and the $container variable can be
20 * used within the file to change the container.
22 * @author Fabien Potencier <fabien@symfony.com>
24 class PhpFileLoader extends FileLoader
29 public function load($resource, $type = null)
31 // the container and loader variables are exposed to the included file below
32 $container = $this->container;
35 $path = $this->locator->locate($resource);
36 $this->setCurrentDir(dirname($path));
37 $this->container->addResource(new FileResource($path));
45 public function supports($resource, $type = null)
47 return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION);