Exemplo n.º 1
0
Arquivo: Wincache.php Projeto: 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);
 }
Exemplo n.º 2
0
Arquivo: Xcache.php Projeto: 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);
 }
Exemplo n.º 3
0
Arquivo: Apc.php Projeto: 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);
 }
Exemplo 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);
 }
Exemplo n.º 5
0
Arquivo: MongoDb.php Projeto: 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;
 }
Exemplo n.º 6
0
Arquivo: File.php Projeto: ksst/kf
 /**
  * Constructor.
  *
  * @param array $options
  */
 public function __construct($options = [])
 {
     parent::__construct($options);
 }
Exemplo 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;
 }