createFromFile() public static method

public static createFromFile ( string $path ) : ConfigFile
$path string
return ConfigFile
Example #1
0
 /**
  * Obtain the (optional) stop-file-config-file, it is placed in the folder of the stop-file, always
  * prefixed with a dot: stop-file-folder/.n98-magerun2.yaml
  *
  * @param string $magerunStopFileFolder
  * @return ConfigFile|null
  */
 public function getStopFileConfigFile($magerunStopFileFolder)
 {
     if (empty($magerunStopFileFolder)) {
         return;
     }
     $stopFileConfigFilePath = $magerunStopFileFolder . '/.' . $this->customConfigFilename;
     if (!file_exists($stopFileConfigFilePath)) {
         return;
     }
     try {
         $stopFileConfigFile = ConfigFile::createFromFile($stopFileConfigFilePath);
         $stopFileConfigFile->applyVariables($this->magentoRootFolder);
     } catch (InvalidArgumentException $e) {
         $stopFileConfigFile = null;
     }
     return $stopFileConfigFile;
 }
 /**
  * Loads a plugin config file and merges it to plugin config
  *
  * @param string $magentoRootFolder
  * @param SplFileInfo $file
  */
 protected function registerPluginConfigFile($magentoRootFolder, $file)
 {
     if (BinaryString::startsWith($file->getPathname(), 'vfs://')) {
         $path = $file->getPathname();
     } else {
         $path = $file->getRealPath();
         if ($path === "") {
             throw new \UnexpectedValueException(sprintf("Realpath for '%s' did return an empty string.", $file));
         }
         if ($path === false) {
             $this->log(sprintf("<error>Plugin config file broken link '%s'</error>", $file));
             return;
         }
     }
     $this->logDebug('Load plugin config <comment>' . $path . '</comment>');
     $localPluginConfigFile = ConfigFile::createFromFile($path);
     $localPluginConfigFile->applyVariables($magentoRootFolder, $file);
     $this->_pluginConfig = $localPluginConfigFile->mergeArray($this->_pluginConfig);
 }
Example #3
0
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function invalidFileThrowsException()
 {
     @ConfigFile::createFromFile(":");
 }