PHPDaemon\Config\Object::loadFile PHP Method

loadFile() public method

Load config file
public loadFile ( $path ) : boolean
return boolean Success
    public function loadFile($path)
    {
        $parser = Parser::parse($path, $this);
        $this->onLoad();
        return !$parser->isErroneous();
    }

Usage Example

 /**
  * Load config-file
  * @param string $paths Path
  * @return boolean - Success.
  */
 public static function loadConfig($paths)
 {
     $apaths = explode(';', $paths);
     foreach ($apaths as $path) {
         if (is_file($p = realpath($path))) {
             $ext = strtolower(pathinfo($p, PATHINFO_EXTENSION));
             if ($ext === 'conf') {
                 return Daemon::$config->loadFile($p);
             } else {
                 Daemon::log('Config file \'' . $p . '\' has unsupported file extension.');
                 return false;
             }
         }
     }
     Daemon::log('Config file not found in \'' . $paths . '\'., dir: ' . __DIR__);
     return false;
 }