config = $config; $this->dsn = $dsn; $this->user = $user; $this->password = $password; } public function getDatabaseDsn() { return $this->dsn; } public function getDbUser() { return $this->user; } public function getDbPassword() { return $this->password; } public function getLoginColumnName() { return $this->config[self::LOGIN_COLUMN_NAME]; } public function egtPasswordColumnName() { return $this->config[self::PASSWORD_COLUMN_NAME]; } public function getSaltColumnName() { return $this->config[self::SALT_COLUMN_NAME]; } public function getRequestScope() { $scope = ''; foreach ($this->config[self::DATA_TO_FETCH] as $data) { $scope .= $data.','; } $scope = substr($scope, 0, -1); $request = 'SELECT '.$scope.' FROM '.$this->config[self::TABLE_NAME].' WHERE '.$this->config[self::LOGIN_COLUMN_NAME].' = :'.$this->config[self::LOGIN_COLUMN_NAME].';'; return $request; } public function getRequestPassword() { $passwordColumns = $this->config[self::PASSWORD_COLUMN_NAME]; if (!empty($this->config[self::SALT_COLUMN_NAME])) { $passwordColumns .= ', '.$this->config[self::SALT_COLUMN_NAME]; } return 'SELECT '.$passwordColumns.' FROM '.$this->config[self::TABLE_NAME].' WHERE '.$this->config[self::LOGIN_COLUMN_NAME].' = :'.$this->config[self::LOGIN_COLUMN_NAME].';'; } }