Fakerino\Configuration\ConfigurationFile\Helper\FileConfigurationLoaderFactory::load PHP Method

load() public method

Finds and returns the file if exists
public load ( ) : Fakerino\Configuration\ConfigurationInterface
return Fakerino\Configuration\ConfigurationInterface
    public function load()
    {
        $file = new File($this->filePath);
        $fileExt = $file->getExtension();
        $fileConfClass = $this->getConfigFileClass($fileExt);
        if (class_exists($fileConfClass)) {
            $fileConf = new $fileConfClass($file);
            return $fileConf;
        }
        throw new ConfNotSupportedException($this->filePath);
    }

Usage Example

Example #1
0
 /**
  * Bootstrap function for Fakerino,
  * setups the global configuration.
  *
  * @param null|array|string $conf
  *
  * @return FakeDataFactory
  */
 public static function create($conf = null)
 {
     self::$defaultConf = new FakerinoConf();
     self::$defaultConf->loadConfiguration();
     if ($conf !== null) {
         $confArray = $conf;
         if (!is_array($conf)) {
             $confTypeFactory = new FileConfigurationLoaderFactory($conf);
             $confParser = $confTypeFactory->load();
             $confArray = $confParser->toArray();
         }
         $conf = $confArray;
     }
     self::$defaultConf = new FakerinoConf($conf);
     self::$defaultConf->loadConfiguration();
     return new FakeDataFactory(self::getDefaultHandler(), new DoctrineLayer(self::getDatabaseConfig()), new TwigTemplate());
 }
All Usage Examples Of Fakerino\Configuration\ConfigurationFile\Helper\FileConfigurationLoaderFactory::load
FileConfigurationLoaderFactory