Surcharge un fichier INI avec le contenu d'un autre fichier INI

@param type $path   Chemin absolu ou relatif du fichier
@throws \Exception
435166
public function surcharge($path)
  {
    $ndata = parse_ini_file($path);
    if (is_null($ndata) || !$ndata){
      throw new \Exception('La lecture du fichier '.$path.' a échouée.');
    }
    $this->values = array_merge($this->values, $ndata);
  }
277701
public static function parseFile($path)
    {
        if(!is_file($path))
        {
            throw new Exception('Invalid file path');
        }

        $toml = file_get_contents($path);

        // Remove BOM if present
        $toml = preg_replace('/^' . pack('H*','EFBBBF') . '/', '', $toml);

        return self::parse($toml);
    }
395924
public function start($path)
    {
        if (is_file($path)) {
            $this->setSchemaFromPath($path);

            return;
        }

        $this->setSchemaFromString($path);
    }
1334355
public static function load($path)
    {
        if (is_dir($path)) {
            foreach (preg_grep('/^\.env$/', scandir($path)) as $filename) {
                $filePath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $filename;
                if (is_readable($filePath)) {
                    foreach (parse_ini_file($filePath) as $envKey => $envValue) {
                        putenv($envKey . '=' . $envValue);
                    }
                }
            }
        } else {
            throw new BaseException('Your path does not directory.');
        }
    }
1007774
public function run(string $path)
    {
        $dir = opendir($path);
        if ($dir === false) {
            throw new Exception(
                'The directory can not be open. '
                .'See php error log for more informations.',
                self::ERR_RUN_OPENDIR
            );
        }

        //Tant qu'il y a des fichiers à lire dans le dossier
        while (($file = readdir($dir)) !== false) {
            $action = $this->itemAction($file, $path);

            if ($action === 'continue') {
                continue;
            } elseif ($action === 'break') {
                break;
            }
            
            //If it's a directory
            if (is_dir($path.'/'.$file)) {
                $this->dirAction($path.'/'.$file);
                continue;
            }
        }

        closedir($dir);
    }
328209
public function publish(string $path)
    {
        if (!is_dir($path)) {
            throw new \Exception("Bad path ($path)");
        }
        $this->recurseCopy($path, base_path('public/'));
    }
486626
public function setBasePath($path)
    {
        if (($this->_basePath = realpath($path)) === false || !is_dir($this->_basePath)) {
            throw new \Exception('程序基本路径' . $this->_basePath . '设置失败');
        }
    }
1343318
public function write( $path, $content )
	{
		try {
			$this->fs->put( $path, $content );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
227018
public function read( $path )
	{
		try {
			return $this->fs->get( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
1131603
public static function setClassIndexMap($path)
    {
        if (is_array($path)) {
            self::$resultClassIndexMap = $path;
        } elseif (file_exists($path) && is_readable($path)) {
            self::$resultClassIndexMap = require_once($path);
        } else {
            throw new RuntimeException("Path $path does not exists or is not readable.");
        }
    }
90876
public function loadStagesFromYaml(string $path): void
    {
        if (!file_exists($path)) {
            throw new FileLoaderLoadException('Stage definition file cannot be found.');
        }
        $pathInfo = pathinfo($path);
        if ($pathInfo['extension'] !== 'yml') {
            throw new FileLoaderLoadException('Stage definition file must include .yml extension.');
        }

        // empty the stages
        $this->stagesByName = [];
        if (!isset($this->yamlFileLoader)) {
            $this->yamlFileLoader = new YamlFileLoader(new FileLocator($pathInfo['dirname']));
        }
        $this->yamlFileLoader->load($pathInfo['basename']);
        $stages = $this->yamlFileLoader->getContent();
        $stages = $stages['stages'];
        foreach ($stages as $key => $stageArray) {
            $this->stagesByName[$key] = $stageArray['class'];
            $this->stageOrder[$stageArray['order']] = $key;
            if (isset($stageArray['default'])) {
                $this->defaultStage = $key;
            }
        }
    }
1195040
private function addAlias($alias, $path)
    {
        if (!is_string($path)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid path provided; must be a string, received %s',
                gettype($path)
            ));
        }

        if (!is_string($alias)) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid alias provided; must be a string, received %s',
                gettype($alias)
            ));
        }

        $this->aliases[$alias] = $this->normalizePath($path);
    }
1172377
public function loadFrom(string $path): void
    {
        $this->path = $path;

        if (is_file($path)) {
            $this->data = require $path;

            if (!is_array($this->data)) {
                throw new ConfigException("Config loaded from path={$path} is not an array");
            }

            $this->loadedAt = time();
        } else {
            throw new ConfigException('Unable to load config from path=' . $path);
        }
    }
309483
public function onFileChanged($path)
    {
        if (!Daemon::lintFile($path)) {
            Daemon::log(__METHOD__ . ': Detected parse error in ' . $path);
            return;
        }
        foreach ($this->files[$path] as $cb) {
            if (is_callable($cb) || is_array($cb)) {
                $cb($path);
            } elseif (!Daemon::$process->IPCManager->importFile($cb, $path)) {
                $this->rmWatch($path, $cb);
            }
        }
    }
1373190
public function registerManifest($path)
    {
        if (! File::exists($path)) {
            throw new \Exception('Extension manifest file does not exist! Path: ' . $path);
        }

        $manifest = File::get($path);
        $manifest = json_decode($manifest, true);
        $this->register($manifest);
    }
767338
public function open($path)
  {
    $this->convertToLF($path);
    $this->spl_file_object = new SplFileObject($path);
    $this->spl_file_object->setCsvControl($this->delimiter);
    $this->columns_name = $this->spl_file_object->fgetcsv();
  }
620156
public function setPath($path)
	{
		if (is_dir($path) && is_writable($path)) {
			$this->path = substr($path, -1) == DIRECTORY_SEPARATOR ? $path : $path . DIRECTORY_SEPARATOR;
			return true;
		}
		throw new Exception('"Path" must be a writable directory.');
	}