Cascade\Config\Loader\FileLoader\PhpArray::load PHP 메소드

load() 공개 메소드

Load a PHP file
public load ( string $resource, string | null $type = null ) : array
$resource string File path to a PHP file that returns an array
$type string | null This is not used
리턴 array Array containing data from the PHP file
    public function load($resource, $type = null)
    {
        $config = (include $resource);
        if (!is_array($config)) {
            throw new \InvalidArgumentException(sprintf('The file "%s" did not return a valid PHP array when included', $resource));
        }
        return $config;
    }

Usage Example

예제 #1
0
 public function testLoadsPhpArrayConfigFromFile()
 {
     $this->assertSame(include __DIR__ . '/../../../Fixtures/fixture_config.php', $this->loader->load(__DIR__ . '/../../../Fixtures/fixture_config.php'));
 }