ZF\Apigility\Admin\Model\AuthenticationEntity::exchangeArray PHP Méthode

exchangeArray() public méthode

public exchangeArray ( array $array )
$array array
    public function exchangeArray(array $array)
    {
        switch ($this->type) {
            case self::TYPE_BASIC:
                $allowedKeys = ['realm', 'htpasswd'];
                break;
            case self::TYPE_DIGEST:
                $allowedKeys = ['realm', 'htdigest', 'digestdomains', 'noncetimeout'];
                break;
            case self::TYPE_OAUTH2:
                $allowedKeys = ['dsntype', 'database', 'dsn', 'username', 'password', 'routematch'];
                break;
        }
        foreach ($array as $key => $value) {
            $key = strtolower(str_replace('_', '', $key));
            if (!in_array($key, $allowedKeys)) {
                continue;
            }
            switch ($key) {
                case 'dsntype':
                    $this->dsnType = $value;
                    break;
                case 'database':
                    $this->database = $value;
                    break;
                case 'dsn':
                    $this->dsn = $value ?: 'mongodb://localhost:27017';
                    break;
                case 'htdigest':
                    $this->htdigest = $value;
                    break;
                case 'htpasswd':
                    $this->htpasswd = $value;
                    break;
                case 'digestdomains':
                    $this->digestDomains = $value;
                    break;
                case 'noncetimeout':
                    $this->nonceTimeout = $value;
                    break;
                case 'password':
                    $this->password = $value;
                    break;
                case 'realm':
                    $this->realm = $value;
                    break;
                case 'routematch':
                    $this->routeMatch = $value;
                    break;
                case 'username':
                    $this->username = $value;
                    break;
            }
        }
    }