Example #1
0
 /**
  * Returns an instance of a class with given `config`. The `name` could be a key from the
  * `classes` array, a fully-namespaced class name, or an object. Typically this method is used
  * in `_init` to create the dependencies used in the current class.
  *
  * @param string|object $name    A `classes` alias or fully-namespaced class name.
  * @param array         $options The configuration passed to the constructor.
  *
  * @return object
  */
 protected static function _instance($name, array $options = [])
 {
     $self = static::_object();
     if (is_string($name) && isset($self->_classes[$name])) {
         $name = $self->_classes[$name];
     }
     return Libraries::instance(null, $name, $options);
 }
Example #2
0
 /**
  * Returns an instance of a class with given `config`. The `name` could be a key from the
  * `classes` array, a fully-namespaced class name, or an object. Typically this method is used
  * in `_init` to create the dependencies used in the current class.
  *
  * @param string|object $name    A `classes` key or fully-namespaced class name.
  * @param array         $options The configuration passed to the constructor.
  *
  * @return object
  */
 protected function _instance($name, array $options = array())
 {
     if (is_string($name) && isset($this->_classes[$name])) {
         $name = $this->_classes[$name];
     }
     return Libraries::instance(null, $name, $options);
 }