Creates EETData object from array received from API

@param $array

@return EETData
1889
static function fromArray($array) {

		$data = new EETData();

		foreach (self::$keyNames as $key) {
			if (array_key_exists($key, $array)) {
				$data->$key = $array[$key];
			}
		}

		$data->rawData = $array;

		return $data;

	}
638129
public static function arrayToObject(array $array = [])
    {
        if (!is_array($array)) {
            throw new \Exception('Not an array');
        }

        $object = new \stdClass();
        if (is_array($array) && count($array) > 0) {
            foreach ($array as $name => $value) {
                if (is_array($value)) {
                    $object->{$name} = self::arrayToObject($value);
                } else {
                    $object->{$name} = $value;
                }
            }
        }

        return $object;
    }
269952
public function copyToArray(array &$array)
    {
        $array['name']         = $this->name;
        $array['defaultEntry'] = $this->defaultEntry;
        $array['description']  = $this->description;
        $array['descriptions'] = LanguageUtility::convertArrayOfArrayCopyableToArray($this->descriptions);
        $array['attributes']   = LanguageUtility::convertArrayOfArrayCopyableToArray($this->attributes);
    }
1372661
protected function doCreateObject(array $array)
    {
        $factor = new Factor($array);

        if (isset($array['factorValues']) && is_array($array['factorValues'])) {

            foreach ($array['factorValues'] as $factorValueData) {
                $mapper = new FactorValuesMapper();
                $factor->values[] = $mapper->createObject($factorValueData);
            }
        }

        return $factor;
    }
730150
protected function doCreateObject(array $array)
    {
        $raw = [];
        foreach ($array as $item) {
            $raw[$item['attributeId']]['id']               = $item['attributeId'];
            $raw[$item['attributeId']]['title']            = $item['title'];
            $raw[$item['attributeId']]['code']             = $item['code'];
            $raw[$item['attributeId']]['cssClass']         = $item['cssClass'];
            $raw[$item['attributeId']]['orderNumber']      = $item['orderNumber'];
            $raw[$item['attributeId']]['showInSpecList']   = $item['showInSpecList'];
            $raw[$item['attributeId']]['useInFilter']      = $item['useInFilter'];
            $raw[$item['attributeId']]['description']      = $item['description'];
            $raw[$item['attributeId']]['attributeGroupId'] = $item['attributeGroupId'];
            $raw[$item['attributeId']]['displayType']      = $item['displayType'];

            $raw[$item['attributeId']]['attributeValues'][] = [
                'id'     => $item['id'],
                'value'  => $item['value'],
                'cssClass' => $item['cssClass'],
                'title'  => $item['valueTitle'],
                'amount' => $item['amount'],
                'orderNumber' => $item['orderNumberAttributeValues'] ?? null
            ];
        }

        $mapper = new AttributesMapper();
        $result = [];
        foreach ($raw as $item) {
            $result[] = $mapper->createObject($item);
        }

        return $result;
    }
1040187
public function fromArray($array) {
		$array=parent::fromArray($array);
		foreach ( $array as $key => $value ) {
			$this->setProperty($key, $value);
		}
		return $array;
	}
655846
public function copyToArray(array &$array)
    {
        $array['parameters']            = $this->parameters;
        $array['clientId']              = $this->clientId;
        $array['clientSecret']          = $this->clientSecret;
        $array['clientCertificate']     = $this->clientCertificate;
        $array['clientCertificatePath'] = $this->clientCertificatePath;
        $array['properties']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }
762958
protected function doCreateObject(array $array)
    {
        $entityFactor = new EntityFactor($array);

        $factor = [
            'id'            => $array['factorId'] ?? null,
            'code'          => $array['factorCode'] ?? null,
            'name'          => $array['factorName'] ?? null,
        ];
        $mapper = new FactorsMapper();
        $entityFactor->factor = $mapper->createObject($factor);

        $factorValue = [
            'id'            => $array['id'] ?? null,
            'name'          => $array['name'] ?? null,
            'factorId'      => $array['factorId'] ?? null,
            'image'         => $array['image'] ?? null,
            'description'   => $array['description'] ?? null,
        ];
        $mapper = new FactorValuesMapper();
        $entityFactor->factorValue = $mapper->createObject($factorValue);

        return $entityFactor;
    }
183436
public static function createFromArray(array $array)
    {
        $scoreStrategy = new self();
        $scoreStrategy->type = $array['type'] ?: self::DEFAULT_TYPE;
        $scoreStrategy->configuration = $array['configuration'] ?? [];
        $scoreStrategy->weight = $array['weight'] ?? self::DEFAULT_WEIGHT;
        $scoreStrategy->scoreMode = $array['score_mode'] ?? self::SCORE_MODE_AVG;
        $scoreStrategy->filter = is_array($array['filter'])
            ? Filter::createFromArray($array['filter'])
            : null;

        return $scoreStrategy;
    }
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);
    }
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);
    }
796388
protected function createFromArray($array)
    {
        $this->id = $array['id'];
        $this->modelType = $array['modelType'];
        $this->modelId = $array['modelId'];
        $this->name = $array['name'];
        $this->price = $array['price'];
        $this->image = $array['image'];
        $this->quantity = $array['quantity'];

        return $this;
    }
1159498
private function mergeData($array)
    {
        $results = [
            'post' => new DataCollection(),
            'file' => new DataCollection()
        ];

        if (count($array['post']) > 0) {
            foreach($array['post'] as $key => $value) {
                foreach($value as $k => $v) {
                    if (is_array($v)) {
                        foreach($v as $kk => $vv) {
                            $results['post'][$k][] = $vv;
                        }
                    } else {
                        $results['post'][$k] = $v;
                    }
                }
            }
        }

        if (count($array['file']) > 0) {
            foreach($array['file'] as $key => $value) {
                foreach($value as $k => $v) {
                    if (is_array($v)) {
                        foreach($v as $kk => $vv) {
                            if(is_array($vv) && (count($vv) === 1)) {
                                $results['file'][$k][$kk] = $vv[0];
                            } else {
                                $results['file'][$k][$kk][] = $vv[0];
                            }
                        }
                    } else {
                        $results['file'][$k][$key] = $v;
                    }
                }
            }
        }

        return $results;
    }
849048
public static function createFromArray(array $array): self
    {
        if (!isset($array['uuid'], $array['app_id'])) {
            throw InvalidFormatException::indexFormatNotValid();
        }

        return new self(
            IndexUUID::createFromArray($array['uuid']),
            AppUUID::createFromArray($array['app_id']),
            $array['is_ok'] ?? false,
            $array['doc_count'] ?? 0,
            $array['size'] ?? '0kb',
            $array['shards'] ?? Config::DEFAULT_SHARDS,
            $array['replicas'] ?? Config::DEFAULT_REPLICAS,
            $array['fields'] ?? [],
            $array['metadata'] ?? []
        );
    }
696216
public function copyToArray(array &$array)
    {
        $array['start']      = $this->start;
        $array['end']        = $this->end;
        $array['developer']  = $this->developer;
        $array['totalCount'] = $this->totalCount;
        $array['clients']    = LanguageUtility::convertArrayOfArrayCopyableToArray($this->clients);
    }
791834
private function arrayClone(array $array) {
        return array_map(function ($element) {
            return ((is_array($element))
                ? $this->arrayClone($element)
                : ((is_object($element))
                    ? clone $element
                    : $element
                )
            );
        }, $array);
    }
28059
public function copyToArray(array &$array)
    {
        parent::copyToArray($array);

        $array['action']                = LanguageUtility::toString($this->action);
        $array['responseContent']       = $this->responseContent;
        $array['username']              = $this->username;
        $array['password']              = $this->password;
        $array['ticket']                = $this->ticket;
        $array['accessToken']           = $this->accessToken;
        $array['accessTokenExpiresAt']  = LanguageUtility::orZero($this->accessTokenExpiresAt);
        $array['accessTokenDuration']   = LanguageUtility::orZero($this->accessTokenDuration);
        $array['refreshToken']          = $this->refreshToken;
        $array['refreshTokenExpiresAt'] = LanguageUtility::orZero($this->refreshTokenExpiresAt);
        $array['refreshTokenDuration']  = LanguageUtility::orZero($this->refreshTokenDuration);
        $array['idToken']               = $this->idToken;
        $array['grantType']             = LanguageUtility::toString($this->grantType);
        $array['clientId']              = $this->clientId;
        $array['clientIdAlias']         = $this->clientIdAlias;
        $array['clientIdAliasUsed']     = $this->clientIdAliasUsed;
        $array['subject']               = $this->subject;
        $array['scopes']                = $this->scopes;
        $array['properties']            = LanguageUtility::convertArrayOfArrayCopyableToArray($this->properties);
    }