/** * Constructor, accepts values then sets the object as immutable * @param array $input */ public function __construct(array $input = []) { if ($this->immutable === false) { parent::__construct($input); $this->immutable = true; } else { $this->throwException(); } }
/** * Constructor, add an array of key => value pairs on instantiation * @param array $input */ public function __construct(array $input = []) { parent::__construct($input); }
public function __construct(array $input) { $defaults = ['value' => '', 'domain' => null, 'path' => null, 'expires' => null, 'secure' => false, 'httponly' => false]; $values = array_replace($defaults, $input); parent::__construct($values); }