public function getArrayCopy()
{
switch ($this->type) {
case self::TYPE_BASIC:
return ['type' => 'http_basic', 'accept_schemes' => [self::TYPE_BASIC], 'realm' => $this->realm, 'htpasswd' => $this->htpasswd];
case self::TYPE_DIGEST:
return ['type' => 'http_digest', 'accept_schemes' => [self::TYPE_DIGEST], 'realm' => $this->realm, 'htdigest' => $this->htdigest, 'digest_domains' => $this->digestDomains, 'nonce_timeout' => $this->nonceTimeout];
case self::TYPE_OAUTH2:
$array = ['type' => 'oauth2', 'dsn_type' => $this->dsnType, 'dsn' => $this->dsn, 'username' => $this->username, 'password' => $this->password, 'route_match' => $this->routeMatch];
if ($this->getDsnType() === self::DSN_MONGO) {
$array['database'] = $this->database;
// Allow server strings that do not include "mongodb://" prefix
if (!empty($this->dsn) && 0 !== strpos($this->dsn, 'mongodb://')) {
$array['dsn'] = 'mongodb://' . $this->dsn;
}
}
return $array;
}
}