Convert an array to an object
@param array  $array The array to convert
@reeturn object
550437
public static function to_object($array, $recursive = false) {
        if (!is_object($array) && !is_array($array)) return $array;

        if (!$recursive) return (object)$array;

        if (is_array($array)) return (object)array_map([
            __CLASS__,
            'to_object'
        ], $array);
        else return $array;
    }
596005
public static function flatten(array $array)
    {
        $result = array();

        array_walk_recursive($array, function ($value, $key) use (& $result) {
            if (is_numeric($key) or is_object($value)) {
                $result[] = $value;
            } else {
                $result[$key] = $value;
            }
        });

        return $result;
    }
1156496
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']            = LanguageUtility::toString($this->action);
        $array['clientId']          = $this->clientId;
        $array['subject']           = $this->subject;
        $array['scopes']            = $this->scopes;
        $array['claims']            = $this->claims;
        $array['token']             = $this->token;
        $array['responseContent']   = $this->responseContent;
        $array['properties']        = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
        $array['clientIdAlias']     = $this->clientIdAlias;
        $array['clientIdAliasUsed'] = $this->clientIdAliasUsed;
    }
1094575
protected function decodeObjectReferences(array &$array)
    {
        foreach ($array as &$value) {
            if (!is_array($value)) {
                continue;
            }

            if (isset($value['__flow_object_type'])) {
                $value = $this->persistenceManager->getObjectByIdentifier($value['__identifier'], $value['__flow_object_type'], true);
            } else {
                $this->decodeObjectReferences($value);
            }
        }
    }
171995
public function copyFromArray(array &$array)
    {
        // key
        $this->setKey(
            LanguageUtility::getFromArray('key', $array));

        // value
        $this->setValue(
            LanguageUtility::getFromArray('value', $array));

        // hidden
        $this->setHidden(
            LanguageUtility::getFromArrayAsBoolean('hidden', $array));
    }
680481
public static function convertStringToValueArray(array $array): array
    {

        foreach ($array as $i => $attr)
            $array[$i] = (is_array($attr) ? self::convertStringToValueArray($attr) : self::convertStringToValues($attr));

        return $array;
    }
179047
public static function ArrayAsObject($Array) {
      if (!is_array($Array))
         return $Array;

      $Return = new stdClass();
      foreach($Array as $Property => $Value) {
         $Return->$Property = $Value;
      }
      return $Return;
   }
1306342
private function formatThrowableObjects(array $array)
    {
        array_walk_recursive($array, function (&$value) {
            if ($value instanceof \Throwable) {
                try {
                    $value = serialize($value);
                } catch (\Throwable $throwable) {
                    $value = $this->formatThrowable($value);
                }
            }
        });

        return $array;
    }
1069953
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['serviceApiKey']       = $this->serviceApiKey;
        $array['clientId']            = $this->clientId;
        $array['subject']             = $this->subject;
        $array['latestGrantedScopes'] = $this->latestGrantedScopes;
        $array['mergedGrantedScopes'] = $this->mergedGrantedScopes;
        $array['modifiedAt']          = LanguageUtility::orZero($this->modifiedAt);
    }
487717
public function copyFromArray(array &$array)
    {
        parent::copyFromArray($array);

        // action
        $this->setAction(
            TokenCreateAction::valueOf(
                LanguageUtility::getFromArray('action', $array)));

        // grantType
        $this->setGrantType(
            GrantType::valueOf(
                LanguageUtility::getFromArray('grantType', $array)));

        // clientId
        $this->setClientId(
            LanguageUtility::getFromArray('clientId', $array));

        // subject
        $this->setSubject(
            LanguageUtility::getFromArray('subject', $array));

        // scopes
        $this->setScopes(
            LanguageUtility::getFromArray('scopes', $array));

        // accessToken
        $this->setAccessToken(
            LanguageUtility::getFromArray('accessToken', $array));

        // tokenType
        $this->setTokenType(
            LanguageUtility::getFromArray('tokenType', $array));

        // expiresIn
        $this->setExpiresIn(
            LanguageUtility::getFromArray('expiresIn', $array));

        // expiresAt
        $this->setExpiresAt(
            LanguageUtility::getFromArray('expiresAt', $array));

        // refreshToken
        $this->setRefreshToken(
            LanguageUtility::getFromArray('refreshToken', $array));

        // properties
        $properties = LanguageUtility::getFromArray('properties', $array);
        $this->setProperties(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $properties, __NAMESPACE__ . '\Property'));
    }
1054139
protected function normalize(array &$array)
    {
        foreach ($array as $key => $value) {
            if (array_key_exists($key, self::$apcFix)) {
                unset($array[$key]);
                $array[self::$apcFix[$key]] = $value;
            }
        }
    }
1090265
public function copyToArray(array &$array)
    {
        $array['accessToken']          = $this->accessToken;
        $array['accessTokenExpiresAt'] = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['scopes']               = $this->scopes;
        $array['properties']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
656206
protected function fromArray(array $array)
    {
        if (is_array($array)) {
            foreach ($array as $index => $element) {
                if (is_array($element)) {
                    $this->xmlWriter->startElement($index);
                    $this->fromArray($element);
                    $this->xmlWriter->endElement();
                } else {
                    $this->xmlWriter->startElement($index);
                    $this->xmlWriter->text($element);
                    $this->xmlWriter->endElement();
                }
            }
        }
    }
914386
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']               = LanguageUtility::toString($this->action);
        $array['accessToken']          = $this->accessToken;
        $array['accessTokenExpiresAt'] = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['scopes']               = $this->scopes;
        $array['properties']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
668677
public function copyFromArray(array &$array)
    {
        // serviceName
        $this->setServiceName(
            LanguageUtility::getFromArray('serviceName', $array));

        // apiKey
        $this->setApiKey(
            LanguageUtility::getFromArray('apiKey', $array));

        // apiSecret
        $this->setApiSecret(
            LanguageUtility::getFromArray('apiSecret', $array));

        // issuer
        $this->setIssuer(
            LanguageUtility::getFromArray('issuer', $array));

        // authorizationEndpoint
        $this->setAuthorizationEndpoint(
            LanguageUtility::getFromArray('authorizationEndpoint', $array));

        // tokenEndpoint
        $this->setTokenEndpoint(
            LanguageUtility::getFromArray('tokenEndpoint', $array));

        // revocationEndpoint
        $this->setRevocationEndpoint(
            LanguageUtility::getFromArray('revocationEndpoint', $array));

        // supportedRevocationAuthMethods
        $supportedRevocationAuthMethods = LanguageUtility::getFromArray('supportedRevocationAuthMethods', $array);
        $this->setSupportedRevocationAuthMethods(
            LanguageUtility::convertArray(
                $supportedRevocationAuthMethods, '\Authlete\Types\ClientAuthMethod::valueOf'));

        // userInfoEndpoint
        $this->setUserInfoEndpoint(
            LanguageUtility::getFromArray('userInfoEndpoint', $array));

        // jwksUri
        $this->setJwksUri(
            LanguageUtility::getFromArray('jwksUri', $array));

        // jwks
        $this->setJwks(
            LanguageUtility::getFromArray('jwks', $array));

        // registrationEndpoint
        $this->setRegistrationEndpoint(
            LanguageUtility::getFromArray('registrationEndpoint', $array));

        // supportedScopes
        $supportedScopes = LanguageUtility::getFromArray('supportedScopes', $array);
        $this->setSupportedScopes(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $supportedScopes, __NAMESPACE__ . '\Scope'));

        // supportedResponseTypes
        $supportedResponseTypes = LanguageUtility::getFromArray('supportedResponseTypes', $array);
        $this->setSupportedResponseTypes(
            LanguageUtility::convertArray(
                $supportedResponseTypes, '\Authlete\Types\ResponseType::valueOf'));

        // supportedGrantTypes
        $supportedGrantTypes = LanguageUtility::getFromArray('supportedGrantTypes', $array);
        $this->setSupportedGrantTypes(
            LanguageUtility::convertArray(
                $supportedGrantTypes, '\Authlete\Types\GrantType::valueOf'));

        // supportedAcrs
        $this->setSupportedAcrs(
            LanguageUtility::getFromArray('supportedAcrs', $array));

        // supportedTokenAuthMethods
        $supportedTokenAuthMethods = LanguageUtility::getFromArray('supportedTokenAuthMethods', $array);
        $this->setSupportedTokenAuthMethods(
            LanguageUtility::convertArray(
                $supportedTokenAuthMethods, '\Authlete\Types\ClientAuthMethod::valueOf'));

        // supportedDisplays
        $supportedDisplays = LanguageUtility::getFromArray('supportedDisplays', $array);
        $this->setSupportedDisplays(
            LanguageUtility::convertArray(
                $supportedDisplays, '\Authlete\Types\Display::valueOf'));

        // supportedClaimTypes
        $supportedClaimTypes = LanguageUtility::getFromArray('supportedClaimTypes', $array);
        $this->setSupportedClaimTypes(
            LanguageUtility::convertArray(
                $supportedClaimTypes, '\Authlete\Types\ClaimType::valueOf'));

        // supportedClaims
        $this->setSupportedClaims(
            LanguageUtility::getFromArray('supportedClaims', $array));

        // serviceDocumentation
        $this->setServiceDocumentation(
            LanguageUtility::getFromArray('serviceDocumentation', $array));

        // supportedClaimLocales
        $this->setSupportedClaimLocales(
            LanguageUtility::getFromArray('supportedClaimLocales', $array));

        // supportedUiLocales
        $this->setSupportedUiLocales(
            LanguageUtility::getFromArray('supportedUiLocales', $array));

        // policyUri
        $this->setPolicyUri(
            LanguageUtility::getFromArray('policyUri', $array));

        // tosUri
        $this->setTosUri(
            LanguageUtility::getFromArray('tosUri', $array));

        // description
        $this->setDescription(
            LanguageUtility::getFromArray('description', $array));

        // accessTokenType
        $this->setAccessTokenType(
            LanguageUtility::getFromArray('accessTokenType', $array));

        // accessTokenDuration
        $this->setAccessTokenDuration(
            LanguageUtility::getFromArray('accessTokenDuration', $array));

        // refreshTokenDuration
        $this->setRefreshTokenDuration(
            LanguageUtility::getFromArray('refreshTokenDuration', $array));

        // idTokenDuration
        $this->setIdTokenDuration(
            LanguageUtility::getFromArray('idTokenDuration', $array));

        // authorizationResponseDuration
        $this->setAuthorizationResponseDuration(
            LanguageUtility::getFromArray('authorizationResponseDuration', $array));

        // authenticationCallbackEndpoint
        $this->setAuthenticationCallbackEndpoint(
            LanguageUtility::getFromArray('authenticationCallbackEndpoint', $array));

        // authenticationCallbackApiKey
        $this->setAuthenticationCallbackApiKey(
            LanguageUtility::getFromArray('authenticationCallbackApiKey', $array));

        // authenticationCallbackApiSecret
        $this->setAuthenticationCallbackApiSecret(
            LanguageUtility::getFromArray('authenticationCallbackApiSecret', $array));

        // supportedSnses
        $supportedSnses = LanguageUtility::getFromArray('supportedSnses', $array);
        $this->setSupportedSnses(
            LanguageUtility::convertArray(
                $supportedSnses, '\Authlete\Types\Sns::valueOf'));
    
        // snsCredentials
        $snsCredentials = LanguageUtility::getFromArray('snsCredentials', $array);
        $this->setSnsCredentials(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $snsCredentials, __NAMESPACE__ . '\SnsCredentials'));

        // createdAt
        $this->setCreatedAt(
            LanguageUtility::getFromArray('createdAt', $array));

        // modifiedAt
        $this->setModifiedAt(
            LanguageUtility::getFromArray('modifiedAt', $array));

        // developerAuthenticationCallbackEndpoint
        $this->setDeveloperAuthenticationCallbackEndpoint(
            LanguageUtility::getFromArray('developerAuthenticationCallbackEndpoint', $array));

        // developerAuthenticationCallbackApiKey
        $this->setDeveloperAuthenticationCallbackApiKey(
            LanguageUtility::getFromArray('developerAuthenticationCallbackApiKey', $array));

        // developerAuthenticationCallbackApiSecret
        $this->setDeveloperAuthenticationCallbackApiSecret(
            LanguageUtility::getFromArray('developerAuthenticationCallbackApiSecret', $array));

        // supportedDeveloperSnses
        $supportedDeveloperSnses = LanguageUtility::getFromArray('supportedDeveloperSnses', $array);
        $this->setSupportedDeveloperSnses(
            LanguageUtility::convertArray(
                $supportedDeveloperSnses, '\Authlete\Types\Sns::valueOf'));
    
        // developerSnsCredentials
        $developerSnsCredentials = LanguageUtility::getFromArray('developerSnsCredentials', $array);
        $this->setDeveloperSnsCredentials(
            LanguageUtility::convertArrayToArrayOfArrayCopyable(
                $developerSnsCredentials, __NAMESPACE__ . '\SnsCredentials'));

        // clientsPerDeveloper
        $this->setClientsPerDeveloper(
            LanguageUtility::orZero(
                LanguageUtility::getFromArray('clientsPerDeveloper', $array)));

        // directAuthorizationEndpointEnabled
        $this->setDirectAuthorizationEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directAuthorizationEndpointEnabled', $array));

        // directTokenEndpointEnabled
        $this->setDirectTokenEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directTokenEndpointEnabled', $array));

        // directRevocationEndpointEnabled
        $this->setDirectRevocationEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directRevocationEndpointEnabled', $array));

        // directUserInfoEndpointEnabled
        $this->setDirectUserInfoEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directUserInfoEndpointEnabled', $array));

        // directJwksEndpointEnabled
        $this->setDirectJwksEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directJwksEndpointEnabled', $array));

        // directIntrospectionEndpointEnabled
        $this->setDirectIntrospectionEndpointEnabled(
            LanguageUtility::getFromArrayAsBoolean('directIntrospectionEndpointEnabled', $array));

        // singleAccessTokenPerSubject
        $this->setSingleAccessTokenPerSubject(
            LanguageUtility::getFromArrayAsBoolean('singleAccessTokenPerSubject', $array));

        // pkceRequired
        $this->setPkceRequired(
            LanguageUtility::getFromArrayAsBoolean('pkceRequired', $array));

        // refreshTokenKept
        $this->setRefreshTokenKept(
            LanguageUtility::getFromArrayAsBoolean('refreshTokenKept', $array));

        // errorDescriptionOmitted
        $this->setErrorDescriptionOmitted(
            LanguageUtility::getFromArrayAsBoolean('errorDescriptionOmitted', $array));

        // errorUriOmitted
        $this->setErrorUriOmitted(
            LanguageUtility::getFromArrayAsBoolean('errorUriOmitted', $array));

        // clientIdAliasEnabled
        $this->setClientIdAliasEnabled(
            LanguageUtility::getFromArrayAsBoolean('clientIdAliasEnabled', $array));

        // supportedServiceProfiles
        $supportedServiceProfiles = LanguageUtility::getFromArray('supportedServiceProfiles', $array);
        $this->setSupportedServiceProfiles(
            LanguageUtility::convertArray(
                $supportedServiceProfiles, '\Authlete\Types\ServiceProfile::valueOf'));

        // tlsClientCertificateBoundAccessTokens
        $this->setTlsClientCertificateBoundAccessTokens(
            LanguageUtility::getFromArrayAsBoolean('tlsClientCertificateBoundAccessTokens', $array));

        // mutualTlsValidatePkiCertChain
        $this->setMutualTlsValidatePkiCertChain(
            LanguageUtility::getFromArrayAsBoolean('mutualTlsValidatePkiCertChain', $array));

        // introspectionEndpoint
        $this->setIntrospectionEndpoint(
            LanguageUtility::getFromArray('introspectionEndpoint', $array));

        // supportedIntrospectionAuthMethods
        $supportedIntrospectionAuthMethods = LanguageUtility::getFromArray('supportedIntrospectionAuthMethods', $array);
        $this->setSupportedIntrospectionAuthMethods(
            LanguageUtility::convertArray(
                $supportedIntrospectionAuthMethods, '\Authlete\Types\ClientAuthMethod::valueOf'));

        // trustedRootCertificates
        $this->setTrustedRootCertificates(
            LanguageUtility::getFromArray('trustedRootCertificates', $array));

        // authorizationSignatureKeyId
        $this->setAuthorizationSignatureKeyId(
            LanguageUtility::getFromArray('authorizationSignatureKeyId', $array));

        // idTokenSignatureKeyId
        $this->setIdTokenSignatureKeyId(
            LanguageUtility::getFromArray('idTokenSignatureKeyId', $array));

        // userInfoSignatureKeyId
        $this->setUserInfoSignatureKeyId(
            LanguageUtility::getFromArray('userInfoSignatureKeyId', $array));
    }
1033343
private function arrayFilterRecursive(array &$array)
    {
        foreach ($array as $key => &$item) {
            is_array($item) && $array[$key] = $this->arrayFilterRecursive($item);
            if ($array[$key] === null ||
                $array[$key] === []
            ) {
                unset($array[$key]);
            }
        }
        return $array;
    }
1159536
public function copyToArray(array &$array)
    {
        $array['developer']              = $this->developer;
        $array['clientId']               = $this->clientId;
        $array['clientIdAlias']          = $this->clientIdAlias;
        $array['clientIdAliasEnabled']   = $this->clientIdAliasEnabled;
        $array['clientSecret']           = $this->clientSecret;
        $array['clientType']             = LanguageUtility::toString($this->clientType);
        $array['redirectUris']           = $this->redirectUris;
        $array['responseTypes']          = LanguageUtility::convertArrayToStringArray($this->responseTypes);
        $array['grantTypes']             = LanguageUtility::convertArrayToStringArray($this->grantTypes);
        $array['applicationType']        = LanguageUtility::toString($this->applicationType);
        $array['contacts']               = $this->contacts;
        $array['clientName']             = $this->clientName;
        $array['clientNames']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->clientNames);
        $array['logoUri']                = $this->logoUri;
        $array['logoUris']               = LanguageUtility::convertArrayOfArrayCopyableToArray($this->logoUris);
        $array['clientUri']              = $this->clientUri;
        $array['clientUris']             = LanguageUtility::convertArrayOfArrayCopyableToArray($this->clientUris);
        $array['policyUri']              = $this->policyUri;
        $array['policyUris']             = LanguageUtility::convertArrayOfArrayCopyableToArray($this->policyUris);
        $array['tosUri']                 = $this->tosUri;
        $array['tosUris']                = LanguageUtility::convertArrayOfArrayCopyableToArray($this->tosUris);
        $array['jwksUri']                = $this->jwksUri;
        $array['jwks']                   = $this->jwks;
        $array['sectorIdentifier']       = $this->sectorIdentifier;
        $array['subjectType']            = LanguageUtility::toString($this->subjectType);
        $array['idTokenSignAlg']         = LanguageUtility::toString($this->idTokenSignAlg);
        $array['idTokenEncryptionAlg']   = LanguageUtility::toString($this->idTokenEncryptionAlg);
        $array['idTokenEncryptionEnc']   = LanguageUtility::toString($this->idTokenEncryptionEnc);
        $array['userInfoSignAlg']        = LanguageUtility::toString($this->userInfoSignAlg);
        $array['userInfoEncryptionAlg']  = LanguageUtility::toString($this->userInfoEncryptionAlg);
        $array['userInfoEncryptionEnc']  = LanguageUtility::toString($this->userInfoEncryptionEnc);
        $array['requestSignAlg']         = LanguageUtility::toString($this->requestSignAlg);
        $array['requestEncryptionAlg']   = LanguageUtility::toString($this->requestEncryptionAlg);
        $array['requestEncryptionEnc']   = LanguageUtility::toString($this->requestEncryptionEnc);
        $array['tokenAuthMethod']        = LanguageUtility::toString($this->tokenAuthMethod);
        $array['tokenAuthSignAlg']       = LanguageUtility::toString($this->tokenAuthSignAlg);
        $array['defaultMaxAge']          = LanguageUtility::orZero($this->defaultMaxAge);
        $array['authTimeRequired']       = $this->authTimeRequired;
        $array['defaultAcrs']            = $this->defaultAcrs;
        $array['loginUri']               = $this->loginUri;
        $array['requestUris']            = $this->requestUris;
        $array['description']            = $this->description;
        $array['descriptions']           = LanguageUtility::convertArrayOfArrayCopyableToArray($this->descriptions);
        $array['createdAt']              = LanguageUtility::orZero($this->createdAt);
        $array['modifiedAt']             = LanguageUtility::orZero($this->modifiedAt);
        $array['extension']              = LanguageUtility::convertArrayCopyableToArray($this->extension);
        $array['tlsClientAuthSubjectDn'] = $this->tlsClientAuthSubjectDn;
        $array['tlsClientCertificateBoundAccessTokens'] = $this->tlsClientCertificateBoundAccessTokens;
        $array['selfSignedCertificateKeyId']            = $this->selfSignedCertificateKeyId;
        $array['softwareId']                            = $this->softwareId;
        $array['softwareVersion']                       = $this->softwareVersion;
        $array['authorizationSignAlg']                  = LanguageUtility::toString($this->authorizationSignAlg);
        $array['authorizationEncryptionAlg']            = LanguageUtility::toString($this->authorizationEncryptionAlg);
        $array['authorizationEncryptionEnc']            = LanguageUtility::toString($this->authorizationEncryptionEnc);
    }