/** * @param string $configFile * @throws \Exception */ public function __construct($configFile) { if (!file_exists($configFile)) { throw new \Exception('The file "' . $configFile . '" doesn\'t exist!'); } $this->configFile = $configFile; $configArray = json_decode(file_get_contents($configFile), true); if (!is_array($configArray)) { throw new \Exception('Wrong format given!'); } parent::__construct($configArray); }
public function __construct($configFile) { if (!file_exists($configFile)) { throw new \Exception('The file "' . $configFile . '" doesn\'t exist!'); } $this->configFile = $configFile; $configArray = (require $this->configFile); if (!is_array($configArray)) { throw new \Exception('no array given!'); } parent::__construct($configArray); }
protected function __construct($sGPC) { $aConfig = array(); switch ($sGPC) { case 'get': $aConfig = $_GET; break; case 'post': $aConfig = $_POST; break; case 'cookie': $aConfig = $_COOKIE; break; default: throw new InvalidArgumentException('Invalid config mode'); } parent::__construct($aConfig); }
/** * @param string $restriction * @param string $separator * @param array|\ArrayObject $data */ public function __construct($restriction, $separator, $data = array()) { $this->setRestriction($restriction . $separator); parent::__construct($data); }
protected function __construct($sConfigFile) { parent::__construct(parse_ini_file($sConfigFile)); }