createFromFile() public static method

public static createFromFile ( string $path ) : ConfigFile
$path string
return ConfigFile
コード例 #1
0
ファイル: ConfigLocator.php プロジェクト: netz98/n98-magerun
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
ファイル: ConfigFileTest.php プロジェクト: netz98/n98-magerun
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function invalidFileThrowsException()
 {
     @ConfigFile::createFromFile(":");
 }