/** * @param string $filePath * @throws Exception */ public function __construct($filePath = '') { if (!file_exists($filePath)) { throw new Exception("Config file dont exists {$filePath}"); } parent::__construct(json_decode(file_get_contents($filePath), true)); }
/** * @param string $filePath * @throws Exception */ public function __construct($filePath = '') { if (!file_exists($filePath)) { throw new Exception("Config file dont exists {$filePath}"); } parent::__construct(require $filePath); }
/** * Ini constructor. * @param string $filePath * @throws Exception */ public function __construct($filePath = '') { if (!file_exists($filePath)) { throw new Exception("Config file dont exists {$filePath}"); } $configArray = parse_ini_file(realpath($filePath), true); if (isset($configArray[Config::CONFIG_INI_SECTOR])) { $configArray = $this->createConfigArray($configArray); } parent::__construct($configArray); }