예제 #1
0
 /**
  * @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);
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }
예제 #4
0
 /**
  * @param string $restriction
  * @param string $separator
  * @param array|\ArrayObject $data
  */
 public function __construct($restriction, $separator, $data = array())
 {
     $this->setRestriction($restriction . $separator);
     parent::__construct($data);
 }
예제 #5
0
 protected function __construct($sConfigFile)
 {
     parent::__construct(parse_ini_file($sConfigFile));
 }