Parse .yml file into LDAP configuration array.

@return array
502306
private function parseYml()
    {
        if (!file_exists($this->path)) {
            touch($this->path);
        }

        return $this->yml->parse(file_get_contents($this->path));
    }
708649
protected function _parseUrlsXml() {

        $urls = array();

        $conf = &jApp::config()->urlengine;
        $significantFile = $conf['significantFile'];
        $basePath = $conf['basePath'];
        $epExt = ($conf['multiview'] ? '.php':'');

        $file = jApp::tempPath('compiled/urlsig/' . $significantFile . '.creationinfos_15.php');

        if (file_exists($file)) {
            require $file;
            foreach ($GLOBALS['SIGNIFICANT_CREATEURL'] as $selector => $createinfo) {
                if ($createinfo[0] != 1 && $createinfo[0] != 4) {
                    continue;
                }
                if ($createinfo[0] == 4) {
                    foreach ($createinfo as $k => $createinfo2) {
                        if ($k == 0) continue;

                        if ($createinfo2[2] == true // https needed -> we don't take this url. FIXME
                         ||count($createinfo2[3]) ) { // there are some dynamique parameters, we don't take it this we cannot guesse dynamic parameters
                            continue;
                        }
                        $urls[] = $basePath.($createinfo2[1]?$createinfo2[1].$epExt:'').$createinfo2[5];
                    }
                }
                else if ($createinfo[2] == true // https needed -> we don't take this url. FIXME
                         ||  count($createinfo[3]) ) { // there are some dynamique parameters, we don't take it this we cannot guesse dynamic parameters
                    continue;
                }
                else {
                    $urls[] = $basePath.($createinfo[1]?$createinfo[1].$epExt:'').$createinfo[5];
                }
            }
        }
        return $urls;
    }
402580
private static function load_yml( $yml_file ) {
		if ( ! $yml_file ) {
			return array();
		}

		$config = Spyc::YAMLLoad( $yml_file );

		// Make sure config-file-relative paths are made absolute.
		$yml_file_dir = dirname( $yml_file );

		if ( isset( $config['path'] ) ) {
			self::absolutize( $config['path'], $yml_file_dir );
		}

		if ( isset( $config['require'] ) ) {
			self::arrayify( $config['require'] );
			$config['require'] = \WP_CLI\Utils\expand_globs( $config['require'] );
			foreach ( $config['require'] as &$path ) {
				self::absolutize( $path, $yml_file_dir );
			}
		}

		// Backwards compat
		// Command 'core config' was moved to 'config create'.
		if ( isset( $config['core config'] ) ) {
			$config['config create'] = $config['core config'];
			unset( $config['core config'] );
		}
		// Command 'checksum core' was moved to 'core verify-checksums'.
		if ( isset( $config['checksum core'] ) ) {
			$config['core verify-checksums'] = $config['checksum core'];
			unset( $config['checksum core'] );
		}
		// Command 'checksum plugin' was moved to 'plugin verify-checksums'.
		if ( isset( $config['checksum plugin'] ) ) {
			$config['plugin verify-checksums'] = $config['checksum plugin'];
			unset( $config['checksum plugin'] );
		}

		return $config;
	}
991183
protected function generate_configuration_array() {
        $configuration = array();
        $configuration['stores'] = $this->configstores;
        $configuration['modemappings'] = $this->configmodemappings;
        $configuration['definitions'] = $this->configdefinitions;
        $configuration['definitionmappings'] = $this->configdefinitionmappings;
        $configuration['locks'] = $this->configlocks;
        return $configuration;
    }
600102
public function settingsAction()
    {
        $config = $this->ldap->getConfig();
        $servers = isset($config['servers']) ? $config['servers'] : null;
        $userCreation = isset($config['userCreation']) ? $config['userCreation'] : null;

        return ['servers' => $servers, 'userCreation' => $userCreation];
    }
1095564
public function loadConfiguration()
    {
        if (!file_exists($this->path)) {
            return array();
        }
        
        if (!is_readable($this->path)) {
            throw new Exception('The file "' . $this->path . '" isn\'t readable!');
        }
        
        $content = file_get_contents($this->path);
        $settings = json_decode($content, true);

        if ($settings == false) {
            return array();
        }
        
        return $settings;
    }
210444
protected function parseConfig($file)
    {
        $namespace = '';
        $directory = '';

        $config = file_get_contents($file);
        switch (pathinfo($file, PATHINFO_EXTENSION)) {
            case 'yml':
            case 'yaml':
                $config = Yaml::parse($config);
                if (isset($config['migrations_namespace'])) {
                    $namespace = $config['migrations_namespace'];
                }
                if (isset($config['migrations_directory'])) {
                    $directory = $config['migrations_directory'];
                }
                break;
            case 'xml':
                $doc = new \DOMDocument();
                $doc->loadXML($config);
                $list = $doc->getElementsByTagName('migrations-namespace');
                if ($list->length) {
                    $namespace = $list->item(0)->nodeValue;
                }
                $list = $doc->getElementsByTagName('migrations-directory');
                if ($list->length) {
                    $directory = $list->item(0)->nodeValue;
                }
                break;
        }

        return [
            'namespace' => $namespace && $namespace[0] == '\\' ? substr($namespace, 1) : $namespace,
            'directory' => $directory,
        ];
    }
1183942
protected function readConfig($path)
    {
        if (!file_exists($path) || !is_file($path) || !is_readable($path)) {
            return array();
        }

        $yaml = new Parser();

        try {
            $config = (array) $yaml->parse(file_get_contents($path));
        } catch (ParseException $e) {
            return array();
        }

        // adjust relative paths
        foreach ($this->paths as $key) {
            if (isset($config[$key])) {
                $config[$key] = $this->normalizePath($config[$key]);
            }
        }

        return $config;
    }
99808
protected function parse(\SplFileInfo $file): array
    {
        try {
            $config = (new Parser())->parseFile($file->getRealPath());
        } catch (ParseException $e) {
            throw new ConfigurationParseException('Unable to parse config file: ' . $e->getMessage());
        }

        return $config;
    }
402851
public function parseData()
    {
        $data = [];
        $file1 = __DIR__.'/Config/App.php';
        $file2 = __DIR__.'/../Config/App.php';
        if (file_exists($file1)) {
            $data += require $file1;
        } elseif (file_exists($file2)) {
            $data += require $file2;
        } else {
            throw new \Exception("Error, while loading Config {$file1} file", 404);
        }

        return $data;
    }
558541
protected function parse($file)
    {
        $data = json_decode(file_get_contents($file), true) ?: Yaml::parse(file_get_contents($file));

        return $data;
    }
649597
public function load() : array
    {
        if (!$this->exists()){
            throw new ConfigFileNotFoundException($this);
        }
        if (!$this->canRead()){
            throw new ConfigFileNotReadableException($this);
        }
    
        $contents = NULL;
        try{
            $contents = $this->getContents();
        }
        catch( FileSystemExceptionInterface $e ){
            throw new ConfigFileInputException($this, $e);
        }
        
        $data = Yaml::parse($contents);
        
        return $data;
    }
1072717
public function fetchDirectories($yaml)
    {
        $parsed = Yaml::parse($yaml);

        if (!isset($parsed['parameters'])) {
            throw new \RuntimeException(sprintf('Configuration must contain root node "parameters" (%s).', $yaml));
        }

        $config = $parsed['parameters'];

        $dirs = [];

        foreach ($this->params as $param) {
            if (!array_key_exists($param, $config)) {
                throw new \RuntimeException(sprintf('Parameter "%s" does not exist (%s).', $param, $yaml));
            }

            $dirs[$param] = trim($config[$param], DIRECTORY_SEPARATOR);
        }

        return $dirs;
    }
1200978
public function getConfiguration()
    {
        $configurationFiles = $this->locator->locate('config.yml', null, false);
        $configurations     = [];

        foreach ($configurationFiles as $path) {
            $configurations[] = $this->loader->load($path);
        }

        return $this->processor->processConfiguration($this->configuration, $configurations);
    }
849954
private function parseConfigFile()
    {
        $lines = [];

        foreach ($this->lines() as $line) {
            $keys = $this->config()[$this->config];

            $lines[] = $this->parseLine($line, $keys);
        }

        $this->writeToEnv("\n");

        return implode('', $lines);
    }
849826
public function parse_data() {
		$data = [];
		foreach ( get_object_vars( $this ) as $key => $value ) {
			$data[ $key ] = 'contributors' === $key ? $this->create_contributors( $value ) : $value;
		}
		$data = $this->faq_as_h4( $data );
		$data = $this->readme_section_as_h4( 'changelog', $data );
		$data = $this->readme_section_as_h4( 'description', $data );

		@unlink( $this->readme_path );

		return $data;
	}
444140
private function _parse($configFile, $exception = true) {
        if ((empty($configFile) || !file_exists($configFile))) {
            if ($exception)
                throw new \Exception("Empty yaml config file or file does not exist: ".$configFile);
            else
                return array();
        }

        $configArr = array();
        $yaml = new \Symfony\Component\Yaml\Parser();

        try {
            $configArr = $yaml->parse(file_get_contents($configFile));
        } catch (\Symfony\Component\Yaml\Exception\ParseException $e) {
            $GLOBALS['logger']->info("Unable to parse the file [ %s ]: %s", $configFile, $e->getMessage());
            if ($exception)
                throw new \Exception("Not a valid yaml file: ".$configFile);
        }

        return $configArr;
    }