N98\Magento\Application\ConfigLocator::getStopFileConfigFile PHP Method

getStopFileConfigFile() public method

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
public getStopFileConfigFile ( string $magerunStopFileFolder ) : ConfigFile | null
$magerunStopFileFolder string
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;
    }

Usage Example

 /**
  * MAGENTO_ROOT/app/etc/n98-magerun.yaml
  *
  * @param string $magentoRootFolder
  * @param string $magerunStopFileFolder
  * @param array $config
  *
  * @return array
  */
 public function loadProjectConfig($magentoRootFolder, $magerunStopFileFolder, array $config)
 {
     if (null !== $this->_projectConfig) {
         return ArrayFunctions::mergeArrays($config, $this->_projectConfig);
     }
     $this->_projectConfig = array();
     $locator = new ConfigLocator($this->_customConfigFilename, $magentoRootFolder);
     if ($projectConfigFile = $locator->getProjectConfigFile()) {
         $this->_projectConfig = $projectConfigFile->toArray();
     }
     if ($stopFileConfigFile = $locator->getStopFileConfigFile($magerunStopFileFolder)) {
         $this->_projectConfig = $stopFileConfigFile->mergeArray($this->_projectConfig);
     }
     return ArrayFunctions::mergeArrays($config, $this->_projectConfig);
 }