__construct() public method

Class constructor.
public __construct ( null | array $options = null )
$options null | array
Example #1
0
 /**
  * {@inheritdoc}
  *
  * @param  null|array                   $options
  * @throws \Phalcon\Mvc\Model\Exception
  */
 public function __construct($options = null)
 {
     if (!is_array($options)) {
         throw new Exception('No configuration given');
     }
     if (!isset($options['redis'])) {
         throw new Exception('Parameter "redis" is required');
     }
     parent::__construct($options);
 }
Example #2
0
 /**
  * {@inheritdoc}
  *
  * @param null|array $options options array
  *
  * @throws \Phalcon\Mvc\Model\Exception
  */
 public function __construct($options = null)
 {
     if (!is_array($options)) {
         throw new Exception('No configuration given');
     }
     if (!isset($options['host'])) {
         throw new Exception('No host given in options');
     }
     if (!isset($options['port'])) {
         $options['port'] = self::$defaultPort;
     }
     if (!isset($options['weight'])) {
         $options['weight'] = self::$defaultWeight;
     }
     parent::__construct($options);
 }