Fakerino\Configuration\ConfigurationFile\PhpConfigurationFile::toArray PHP Method

toArray() public method

public toArray ( )
    public function toArray()
    {
        $conf = null;
        $phpConfFile = $this->getConfFilePath();
        require $phpConfFile;
        if ($conf === null) {
            throw new ConfNotSupportedException($phpConfFile);
        }
        return $conf;
    }

Usage Example

 public function testPhpWrongConfFile()
 {
     $this->setExpectedException('Fakerino\\Configuration\\Exception\\ConfNotSupportedException');
     $fileDir = __DIR__ . '/../../Fixtures/';
     $phpFilePath = $fileDir . 'fileWrongConf.php';
     $phpFile = new File($phpFilePath);
     $phpConf = new PhpConfigurationFile($phpFile);
     $this->assertInternalType('array', $phpConf->toArray());
 }
PhpConfigurationFile