public function __construct($config) { parent::__construct($config); if (!array_key_exists('users', $config) || !is_array($config['users'])) { throw new \InvalidArgumentException('No declare users'); } $this->users = $config['users']; }
/** * Initialize the PDO connection and merge user * config with defaults. * * > Changes for depenencies injection! (PDO Connection) * * @param array $config */ public function __construct($config) { parent::__construct($config); $this->config = array_merge($this->settings, $this->config); if (!isset($this->config['pdo']) || !$this->config['pdo'] instanceof \PDO) { throw new \InvalidArgumentException('You must add valid pdo connection object'); } $this->pdo = $this->config['pdo']; }
/** * @param array $config * @throws \InvalidArgumentException */ public function __construct($config) { parent::__construct($config); $this->config = array_merge($this->settings, $this->config); if (!isset($this->config['user.class']) || !is_object($this->config['user.class'])) { throw new \InvalidArgumentException('You must add valid User Class object'); } $this->user = $this->config['user.class']; }