file = $yamlfile; if (is_file($yamlfile)) { $yaml = Yaml::parse(file_get_contents($yamlfile)); if (isset($yaml) && is_array($yaml)) { foreach ($yaml as $param => $value) { if (isset($this->$param) && isset($value)) { $this->$param = $value; } } } } if (getenv('CONVERT')) { $this->convert = getenv('CONVERT'); } } /** * Get singleton instance * * @param string $yamlfile YAML config file name * * @return Config */ public static function getInstance($yamlfile = 'config.yml') { $yamlfile = __DIR__.'/../'.$yamlfile; if (is_null(self::$instance) || self::$instance->file != $yamlfile) { self::$instance = new Config($yamlfile); } return self::$instance; } /** * Destroy singleton instance * @return void */ public static function destroyInstance() { self::$instance = null; } }