Load INI file

@since   1.0
@param   string $filename File path.
@return  bool|$this
439244
public function load($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception('Ini file "' . $filename . '" doesn\'t exist.');
            return false;
        }
        $this->filename = $filename;
        return $this;
    }
1099631
public function client($filename)
    {
        $path = $this->clientPath($filename, false);
        return Eresus_Template::loadFromFile($path);
    }
795789
public function setFileName($filename)
  {
    $a = explode('.', $filename);

    $this->file_name      = $filename;
    $this->file_extension = count($a) >= 2 ? array_pop($a) : false;

    return $this;
  }
1123726
public static function load($filename)
    {
        if (!is_readable($filename)) {
            throw new IOError($filename, 'File not found or file is not readable');
        }
        $content = @file_get_contents($filename);
        if ($content === false) {
            self::throwNativeError($filename);
        }
        return $content;
    }
232884
public static function loadRuntimeInfo($fileName)
    {
        if(!is_file($fileName))
        {
            return false;
        }
        static::$runtimeInfo = unserialize(file_get_contents($fileName));
        $data = static::$runtimeInfo->annotationParserData;
        Annotation::getInstance()->getParser()->setData($data[0]);
        Annotation::getInstance()->getParser()->setFileMap($data[1]);
        Annotation::getInstance()->getParser()->setParsers(static::$runtimeInfo->annotationParserParsers);
        AnnotationManager::setAnnotations(static::$runtimeInfo->annotationManagerAnnotations);
        AnnotationManager::setAnnotationRelation(static::$runtimeInfo->annotationManagerAnnotationRelation);
        foreach(static::$runtimeInfo->parsersData as $parserClass => $data)
        {
            $parser = $parserClass::getInstance();
            $parser->setData($data);
        }
        return true;
    }
1023904
public static function loadPhpFile($filename)
    {
        $filePath = realpath($filename);

        /**
         * I lifed this from phpunits FileLoader class
         *
         * @see https://github.com/sebastianbergmann/phpunit/pull/2751
         */
        $isReadable = @\fopen($filePath, 'r') !== false;

        if (!$filePath || !$isReadable) {
            throw new \Exception(sprintf("Cannot open file %s \n", $filename));
        }

        include_once $filePath;

        return $filePath;
    }
623266
public function load(string $fileName)
    {
        if (null === $this->handle) {
            throw new DriverException('The image ' . $fileName . ' seems to be broken.');
        }

        return $this->handle;
    }
727565
public static function loadINI($filepath,$prefix_path=null){
    $results = parse_ini_file($filepath,true);
    if($results) {
      $results = static::filterWith(["load.ini", "load"], $results);
      static::loadArray($results,$prefix_path);
    }
  }
569694
protected function loadFile($filename) {
        $lines = file($filename, FILE_IGNORE_NEW_LINES);            // don't use FILE_SKIP_EMPTY_LINES to have correct line
                                                                    // numbers for error messages
        if ($lines && strStartsWith($lines[0], "\xEF\xBB\xBF")) {
            $lines[0] = substr($lines[0], 3);                       // detect and drop a possible BOM header
        }

        foreach ($lines as $i => $line) {
            $line = trim($line);
            if (!strlen($line) || $line[0]=='#')                    // skip empty and comment lines
                continue;

            $parts = explode('=', $line, 2);                        // split key/value
            if (sizeof($parts) < 2) {
                // Don't trigger a regular error as it will cause an infinite loop if the same config is used by the error handler.
                $msg = __METHOD__.'()  Skipping syntax error in "'.$filename.'", line '.($i+1).': missing key-value separator';
                stderr($msg);
                error_log($msg, ERROR_LOG_DEFAULT);
                continue;
            }
            $key      = trim($parts[0]);
            $rawValue = trim($parts[1]);

            // drop possible comments
            if (strpos($rawValue, '#')!==false && strlen($comment=$this->getLineComment($rawValue))) {
                $value = trim(strLeft($rawValue, -strlen($comment)));
            }
            else {
                $value = $rawValue;
            }

            // parse and store property value
            $this->setProperty($key, $value);
        }
        return true;
    }
222413
public static function isFileLoaded($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    return array_search($fileName, self::$files) !== false;
  }
430693
protected function loadTokenFromFile($filename)
    {
        if (strpos($filename, '/') !== 0 && strpos($filename, '\\') !== 0) {
            $filename = $this->config->getUserConfigDir() . '/' . $filename;
        }

        $content = file_get_contents($filename);
        if ($content === false) {
            throw new \RuntimeException('Failed to read file: ' . $filename);
        }

        return trim($content);
    }
318991
public function load(string $filename): \Nofuzz\Config\Config
  {
    # Attempt to load config file
    if ( file_exists($filename) ) {
      # Set filename
      $this->filename = $filename;
      # Load the config
      $configArray = json_decode( file_get_contents($filename), true);
      if ($configArray) {
        // $configArray = $this->array_change_key_case_recursive($configArray); // Lowercase the keys
        # Merge the Config with existing config
        // $this->confValues = array_replace_recursive($this->confValues, $configArray);
        $this->confValues = $configArray;
      } else {
        throw new \RunTimeException('Invalid JSON file "'.$filename.'"');

      }
    } else {
      throw new \RunTimeException('Config file "'.$filename.'" not found');

    }

    return $this;
  }
787356
public function load($filename)
    {
        if ($t = $this->tryLoad($filename)) {
            return $t;
        }

        throw new Exception([
            'Unable to read template from file',
            'cwd'  => getcwd(),
            'file' => $filename,
        ]);
    }
108697
protected function loadFile($name, $filename)
    {
        $file = CompiledYamlFile::instance($filename);
        if (preg_match('|languages\.yaml$|', $filename)) {
            $this->object->mergeRecursive((array) $file->content());
        } else {
            $this->object->mergeRecursive([$name => $file->content()]);
        }
        $file->free();
    }
539411
public final function compose(string $fileName): LoaderInterface
    {
       if (is_file($fileName)){
           $config = json_decode(file_get_contents($fileName));
           if (is_object($config)
            && isset($config->{"autoload"})
            && isset($config->{"autoload"}->{"psr-4"})) {
               $includePath = dirname($fileName) . DIRECTORY_SEPARATOR;
               foreach ($config->{"autoload"}->{"psr-4"} as $key => $value) {
                   $this->addPrefix($key, $includePath . $value);
               }
           }
       }
       return $this;
    }
1062696
public function loadFile($filename){
		$this->connection->connect();
		$abort = ignore_user_abort();
		@set_time_limit(0);
		ignore_user_abort(true);

		$handle = @fopen($filename, 'r');
		if($handle === false){
			ignore_user_abort($abort);
			throw new NeevoException("Cannot open file '$filename' for SQL import.");
		}

		$sql = '';
		$count = 0;
		while(!feof($handle)){
			$content = fgets($handle);
			$sql .= $content;
			if(substr(rtrim($content), -1) === ';'){
				// Passed directly to driver without logging.
				$this->connection->getDriver()->runQuery($sql);
				$sql = '';
				$count++;
			}
		}
		if(trim($sql)){
			$this->connection->getDriver()->runQuery($sql);
			$count++;
		}
		fclose($handle);
		ignore_user_abort($abort);
		return $count;
	}
2084
protected function load($filename)
    {
        $lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        if ($lines === false) {
            throw new \InvalidArgumentException('Invalid file');
        }

        $entry      = self::newEntry();
        $lastKw     = null;
        $lastIndex  = null;

        foreach ($lines as $line) {
            if ($line[0] === '#') {
                $this->maybePushEntry($entry);
                if (strlen($line) === 1) {
                    continue;
                }
                switch ($line[1]) {
                    case ' ':   # Translator comment
                        break;
                    case '.':   # Extracted comment
                        break;
                    case ':':   # File/line reference
                        break;
                    case ',':   # Flags
                        break;
                    case "|":   # Previous information
                        # The initial marker is followed by a keyword
                        # (either "msgid", "msgctxt" or "msgid_plural"),
                        # detailing what the previous information was.
                        break;
                }
                continue;
            }

            $line   = ltrim($line, " \t");
            $len    = strlen($line);

            // Reset keyword index on new entry
            if (!count($entry['msgstr'])) {
                $lastIndex = null;
            }

            // Look for continuation strings.
            if (strlen($line) >= 2 && $line[0] === '"' && $line[$len-1] === '"') {
                // We found a string, but it has no predecessor.
                if ($lastKw === null) {
                    throw new \InvalidArgumentException();
                }

                $line   = stripcslashes((string) substr($line, 1, -1));

                if ($lastKw === 'msgstr') {
                    $index = $lastIndex === null ? 0 : $lastIndex;
                } else {
                    $index = null;
                }

                if ($index === null) {
                    if (is_array($entry[$lastKw])) {
                        throw new \InvalidArgumentException();
                    } else {
                        $entry[$lastKw] .= $line;
                    }
                } else {
                    if (!is_array($entry[$lastKw])) {
                        throw new \InvalidArgumentException();
                    } else {
                        $entry[$lastKw][$index] .= $line;
                    }
                }
                continue;
            }

            $kwLen  = strcspn($line, " \t");
            $kw     = (string) substr($line, 0, $kwLen);
            $index  = null;
            $line   = ltrim((string) substr($line, $kwLen), " \t");

            $brkOpen    = strpos($kw, '[');
            $brkClose   = strpos($kw, ']');
            if ($brkOpen !== false || $brkClose !== false) {
                if ($brkOpen === false || $brkClose === false || $brkClose < $brkOpen) {
                    throw new \InvalidArgumentException();
                }

                $nlen = strspn($kw, '1234567890', $brkOpen + 1, $brkClose - $brkOpen - 1);
                if ($nlen === 0 || $nlen !== $brkClose - $brkOpen - 1) {
                    throw new \InvalidArgumentException();
                }

                $index  = (int) substr($kw, $brkOpen + 1, $nlen);
                $kw     = (string) substr($kw, 0, $brkOpen);
            }

            if (strlen($line) < 2 || $line[0] !== '"' || $line[strlen($line)-1] !== '"') {
                throw new \InvalidArgumentException();
            }
            $line = stripcslashes((string) substr($line, 1, -1));

            switch ($kw) {
                case "msgstr":
                    if ($index === null) {
                        if (isset($entry[$kw][0])) {
                            throw new \InvalidArgumentException();
                        }
                        $entry[$kw][0] = $line;
                    } else {
                        if (array_key_exists($index, $entry[$kw])) {
                            throw new \InvalidArgumentException();
                        }
                        $entry[$kw][$index] = $line;
                        $lastIndex = $index;
                    }
                    break;

                case "msgctxt":
                    // Intentional fall-through
                case "msgid":
                    $this->maybePushEntry($entry);
                    // Intentional fall-through
                case 'msgid_plural':
                    if ($index !== null || isset($entry[$kw])) {
                        throw new \InvalidArgumentException();
                    }
                    $entry[$kw] = $line;
                    break;

                default:
                    throw new \InvalidArgumentException();
            }
            $lastKw = $kw;
        }

        // Push the last entry.
        $this->maybePushEntry($entry);
    }