for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the PPI Framework.
*
* @copyright Copyright (c) 2012 Paul Dragoonis <[email protected]>
* @license http://opensource.org/licenses/mit-license.php MIT
* @link http://www.ppi.io
*/
namespace PPI\Framework\Config\Loader;
use Symfony\Component\Config\Loader\FileLoader;
* PhpFileLoader loads app configuration from a PHP file.
* @author Vítor Brandão <[email protected]>
class PhpFileLoader extends FileLoader
{
* Loads a PHP file.
* @param mixed $file The resource
* @param string $type The resource type
* @throws \InvalidArgumentException
* @return array Array with configuration
public function load($file, $type = null)
$path = $this->locator->locate($file);
$this->setCurrentDir(dirname($path));
$config = require $path;
// not an array
if (!is_array($config)) {
throw new \InvalidArgumentException(sprintf('The file "%s" must contain a PHP array.', $path));
}
return $config;
* Returns true if this class supports the given resource.
* @param mixed $resource A resource
* @return bool true if this class supports the given resource, false otherwise
public function supports($resource, $type = null)
return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION);