src/config/Config.php
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;
    }
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;
    }
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 ; }
Load a single properties file. New settings overwrite existing ones.

@param  string $filename

@return bool - success status
Load a single properties file . New settings overwrite existing ones .