Cascade\Config\Loader\FileLoader\PhpArray::load PHP Method

load() public method

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
return 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

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