lithium\core\Object::__construct PHP Method

__construct() public method

Constructor. Initializes class configuration ($_config), and assigns object properties using the _init() method, unless otherwise specified by configuration. See below for details.
See also: lithium\core\Object::$_config
See also: lithium\core\Object::_init()
public __construct ( array $config = [] ) : void
$config array The configuration options which will be assigned to the `$_config` property. This method accepts one configuration option: - `'init'` _boolean_: Controls constructor behavior for calling the `_init()` method. If `false`, the method is not called, otherwise it is. Defaults to `true`.
return void
    public function __construct(array $config = array())
    {
        $defaults = array('init' => true);
        $this->_config = $config + $defaults;
        if ($this->_config['init']) {
            $this->_init();
        }
    }

Usage Example

Beispiel #1
0
 /**
  * Constructor.
  *
  * @param array $config Configuration array. You can override the default algorithm.
  */
 public function __construct(array $config = [])
 {
     if (!isset($config['secret'])) {
         throw new ConfigException('Jwt strategy requires a secret key.');
     }
     parent::__construct($config + $this->_defaults);
 }
All Usage Examples Of lithium\core\Object::__construct