Reads a INI file and parses its values into an array.

@param string $file The file path to parse.
332490
public function read($file)
    {
        $this->filePath = $file;
        $this->config = parse_ini_file($this->filePath);
    }
1224678
public function loadConfig($file)
    {
        $options = [];
        try {
            $loader = new PhpConfig();
            $options = $loader->read($file);
        } catch (\Exception $e) {
            Log::warning($e->getMessage());
        }
		$this->config('options', $options);
	}
1258586
private function loadFile ($file)
	{
		if (!isset ($this->files[$file]))
		{
			$filename = $this->folder . $file . '.php';

			// First load these
			if (file_exists ($filename))
			{
				$this->files[$file] = include ($filename);
			}

			// Now overload with environment values
			if (isset ($this->environment))
			{
				$filename = $this->folder . $this->environment . '/' . $file . '.php';
				if (file_exists ($filename))
				{
					$this->merge ($file, include ($filename));
				}
			}

		}
	}
951361
public static function ini($ini_file)
    {
        // disabled
        if (!static::_debug()) {
            return false;
        }

        // read it
        if (!$_ = @parse_ini_file($ini_file, 1)) {
            return false;
        }

        // render it
        if (realpath($ini_file)) {
            $ini_file = realpath($ini_file);
        }

        static::heading("This is a list of all the values from the ", $ini_file, "INI file");
        return static::dump($_);
    }
535282
protected function load(string $file): void
	{
		$this->configuration[$file] = $this->loader->load($file, $this->environment);
	}
528751
public function loadIni(string $iniFile)
    {
        $iniFile = realpath($iniFile);
        $iniMap = parse_ini_file($iniFile, true, INI_SCANNER_RAW);
        if ($iniMap === false) {
            throw new \RuntimeException("Configuration file " . $iniFile . " can't be loaded");
        }
        $this->load($iniMap);
    }
355170
protected function parseFile($file)
    {
        $this->file    = $file;
        // When running as a PHAR, copy the SQLite database
        // to a temporary file. Required as the SQLite3 driver
        // does not support streams (and it can"t, see #55154).
        if (!strncasecmp(__FILE__, 'phar://', 7)) {
            $this->file = tempnam(
                sys_get_temp_dir(),
                'Wordlists'
            );
            copy($file, $this->file);
        }

        $this->db   = new \PDO('sqlite:' . $this->file);
        $metadata   = $this->db->query(
            'SELECT type, value '.
            'FROM metadata '.
            'ORDER BY type ASC, id ASC'
        );
        foreach ($metadata as $row) {
            if (!array_key_exists($row['type'], $this->metadata)) {
                continue;
            }
            if (is_array($this->metadata[$row['type']])) {
                $this->metadata[$row['type']][] = $row['value'];
            } else {
                $this->metadata[$row['type']] = $row['value'];
            }
        }

        // Try to create a collator for the given locale.
        $this->collator = new \Collator(
            str_replace('-', '_', $this->metadata['locale'])
        );
        // -127 = U_USING_DEFAULT_WARNING
        // -128 = U_USING_FALLBACK_WARNING.
        //    0 = U_ZERO_ERROR (no error).
        if (!in_array(intl_get_error_code(), array(-127, -128, 0))) {
            throw new \Erebot\InvalidValueException(
                "Invalid locale (".$this->metadata['locale']."): ".
                intl_get_error_message()
            );
        }
        // Ignore differences in case, accents and punctuation.
        $this->collator->setStrength(\Collator::PRIMARY);

        $this->countQuery = $this->db->prepare(
            'SELECT COUNT(1) '.
            'FROM words'
        );

        $this->getQuery = $this->db->prepare(
            'SELECT value '.
            'FROM words '.
            'ORDER BY sortkey ASC '.
            'LIMIT 1 OFFSET :offset'
        );

        $this->existsQuery = $this->db->prepare(
            'SELECT value '.
            'FROM words '.
            'WHERE sortkey = :key '.
            'LIMIT 1'
        );
    }
1144098
public static function readConfigFile($file = self::DEFAULT_CONFIG_FILE)
    {
        if (!is_string($file)) {
            throw new InvalidArgumentException('The config file path must be a string, type passed "'.gettype($file).'".');
        }

        $baseDir = realpath(dirname($file));
        $searchDirs = array(
            $baseDir.'/',
            $baseDir.'/../',
            $baseDir.'/../../',
            $baseDir.'/config/',
            $baseDir.'/../config/',
            $baseDir.'/../../config/'
        );

        $filename = basename($file);

        $configFile = null;
        foreach ($searchDirs as $dir) {
            if (realpath($dir.$filename) and is_readable($dir.$filename)) {
                $configFile = realpath($dir.$filename);
                break;
            }
        }

        if (is_null($configFile) and $file !== self::DEFAULT_CONFIG_FILE) {
            throw new InvalidArgumentException('The config file "'.$file.'" cannot be found or read.');
        }

        if (!$configFile) {
            return static::$config;
        }

        // Try to parse the contents
        try {
            $yaml = Yaml\Yaml::parse(file_get_contents($configFile));
        } catch (Yaml\Exception\ParseException $e) {
            throw new Exception('Unable to parse the config file: '.$e->getMessage());
        }

        return static::$config = $yaml;
    }
605683
private function initialize($file)
    {
        if (file_exists($file)) {
            $this->file = realpath($file);
            return false;
        }
        file_put_contents($file, '');
        $this->file = realpath($file);
        return true;
    }
885322
protected function loadFile($file)
    {
        $requiredFiles = $this->getRequiredFiles($file);
        $this->values[$file] = true;

        foreach ($requiredFiles as $fileToRequire) {
            $overrideConfig = require $fileToRequire['path'];
            $this->config->addConfig([$file => $overrideConfig], $fileToRequire['environment']);
        }
    }
213606
public function readBinary($file)
    {
        if (!($fd = fopen($file, "rb"))) {
            throw new IOException("Could not open file {$file}!");
        }

        $this->readBinaryStream($fd);
        fclose($fd);
    }
24315
protected function _read($file) {
		$text = file_get_contents($file);
		if (empty($text)) {
			return [];
		}
		$pieces = explode(NL, $text);
		return $pieces;
	}
712899
public function init($file, array $data = null)
    {
        if ($data === null) {
            $data = $this->setJsonDefaults([]);
        }
        $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN));
    }
799730
protected function parseIni( $file ) {
		$parsed = array( );
		if ( is_array( $file ) ) {
			$parsed = $file;
		} else if ( \UString::has( $file, PHP_EOL ) ) {
			$parsed = @parse_ini_string( $file, TRUE );
			if ( $parsed === FALSE ) {
				$this->manageError( 'The ini string has a bad format.' );
			}
		} else {
			if ( is_file( $file ) ) {
				$parsed = @parse_ini_file( $file, TRUE );
				if ( $parsed === FALSE ) {
					$this->manageError( 'The ini file has a bad format: ' . $file );
				}
			} else {
				$this->manageError( 'No such file or directory: ' . $file );
			}
		}
		return $parsed;
	}
1329562
public function read($file)
    {
        $fp = fopen($file, 'r+');

        $contents = '';

        while ($part = fread($fp, 1024)) {
            $contents .= $part;
        }

        if (null !== $fp) {
            fclose($fp);
        }

        return $contents;
    }
1274692
public function readHelpFile($file)
    {
        $this->helpArray = array_merge(
            $this->helpArray,
            (array)parse_ini_string($this->pool->fileService->getFileContents($file))
        );
    }
740806
public function parse($file)
    {
        $this->reader->open($file);
        $parsed = $this->reader->parse();

        $data = $this->parseElements($parsed['value']);

        return $this->collection;
    }