Esempio n. 1
0
File: Wincache.php Progetto: ksst/kf
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     if (extension_loaded('wincache') === false) {
         throw new Exception('The PHP extension wincache is not loaded! You may enable it in "php.ini"!');
     }
     parent::__construct($options);
 }
Esempio n. 2
0
File: Xcache.php Progetto: ksst/kf
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     if (!extension_loaded('xcache')) {
         throw new Exception('The PHP extension "xcache" is not loaded. You may enable it in "php.ini"!');
     }
     parent::__construct($options);
 }
Esempio n. 3
0
File: Apc.php Progetto: ksst/kf
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     if (extension_loaded('apc') === false) {
         throw new \Koch\Exception\Exception('The PHP extension APC (Alternative PHP Cache) is not loaded. You may enable it in "php.ini"!');
     }
     $enabled = ini_get('apc.enabled');
     if (PHP_SAPI === 'cli') {
         $enabled = $enabled && (bool) ini_get('apc.enable_cli');
     }
     if ($enabled === false) {
         throw new \Koch\Exception\Exception('The PHP extension APC (Alternative PHP Cache) is not loaded.' . "You may enable it with 'apc.enabled=1' and 'apc.enable_cli=1'!");
     }
     parent::__construct($options);
 }
Esempio n. 4
0
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     if (extension_loaded('eaccelerator') === false) {
         throw new Exception('The PHP extension eAccelerator (cache) is not loaded! You may enable it in "php.ini!"');
     }
     // @todo ensure eaccelerator 0.9.5 is in use
     // from 0.9.6 the user cache functions are removed
     /*if (false === function_exists('eaccelerator_info')) {
           throw new \Exception('eAccelerator isn\'t compiled with info support!');
       } else {
           $info = eaccelerator_info();
           $version = $info['name'];
       }*/
     parent::__construct($options);
 }
Esempio n. 5
0
File: MongoDb.php Progetto: ksst/kf
 public function setOption($key, $value)
 {
     switch ($key) {
         case 'database':
             $database = (string) $value;
             if ($database === '') {
                 throw new \InvalidArgumentException('Database can not be empty.');
             }
             $this->options['database'] = $database;
             break;
         case 'collection':
             $database = (string) $value;
             if ($database === '') {
                 throw new \InvalidArgumentException('Collection can not be empty.');
             }
             $this->options['collection'] = $database;
             break;
         default:
             // maybe the option is known on the parent class, otherwise will throw excetion
             parent::setOption($key, $value);
     }
     return true;
 }
Esempio n. 6
0
File: File.php Progetto: ksst/kf
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     parent::__construct($options);
 }
Esempio n. 7
0
 /**
  * Sets a single option.
  *
  * @param string Key.
  * @param mixed Value.
  *
  * @return bool True, if successfull.
  */
 public function setOption($key, $value)
 {
     switch ($key) {
         case 'useConnection':
             $value = (string) $value;
             if ($value === '') {
                 throw new \InvalidArgumentException('useConnection options can not be empty.');
             }
             $this->options['useConnection'] = $value;
             break;
         case 'connection':
             $connection = (array) $value;
             if (is_array($connection) === false) {
                 throw new \InvalidArgumentException('Connection option must be array.');
             }
             $this->options['connection'] = $connection;
             break;
         default:
             // maybe the option is known on the parent class, otherwise will throw excetion
             parent::setOption($key, $value);
     }
     return true;
 }