Build the response from an array.

@param  array  $array

@return \Arcanedev\NoCaptcha\Utilities\ResponseV3
338184
public static function fromArray(array $array)
    {
        $hostname       = $array['hostname'] ?? null;
        $challengeTs    = $array['challenge_ts'] ?? null;
        $apkPackageName = $array['apk_package_name'] ?? null;
        $score          = isset($array['score']) ? floatval($array['score']) : null;
        $action         = $array['action'] ?? null;

        if (isset($array['success']) && $array['success'] == true)
            return new static(true, [], $hostname, $challengeTs, $apkPackageName, $score, $action);

        if ( ! (isset($array['error-codes']) && is_array($array['error-codes'])))
            $array['error-codes'] = [ResponseV3::E_UNKNOWN_ERROR];

        return new static(false, $array['error-codes'], $hostname, $challengeTs, $apkPackageName, $score, $action);
    }
221372
private function buildRequestRate($array)
    {
        $result = [];
        foreach ($array as $pair) {
            $string = self::DIRECTIVE_REQUEST_RATE . ':' . $pair['ratio'];
            if (isset($pair['from']) &&
                isset($pair['to'])
            ) {
                $string .= ' ' . $pair['from'] . '-' . $pair['to'];
            }
            $result[] = $string;
        }
        return $result;
    }
635938
protected function payment(array $array)
    {
        $payment = new Payment();
        if ($array) {
            foreach ($array as $k => $v) {
                if (array_key_exists($k, $payment) && (strlen($v))) {
                    $payment->$k = $v;
                }
            }
        }
        return new \SoapVar($payment, SOAP_ENC_OBJECT, self::SOAP_PAYMENT, self::PAYLINE_NAMESPACE);
    }
1095869
public function hydrateFromArray(array $array)
    {
        $this->clear();

        //If this is a 0-indexed numerical key array, add 1 to all the keys so
        //it is a 1-indexed numerical key array
        if (current(array_keys($array)) === 0) {
            $array = array_combine(
                range(1, count($array)),
                array_values($array)
            );
        }

        foreach ($array as $key => $value) {
            $this->push(
                $this->wye->makeBinding($key, $value)
            );
        }

        return $this;
    }
673869
public static function createFromArray(array $array): self
    {
        if (empty($array['name'])) {
            throw InvalidFormatException::queryFormatNotValid($array);
        }

        return self::create(
            $array['name'],
            $array['field'] ?? 'uuid.type',
            (int) ($array['application_type'] ?? Filter::AT_LEAST_ONE),
            $array['filter_type'] ?? Filter::TYPE_FIELD,
            $array['subgroup'] ?? [],
            $array['sort'] ?? self::SORT_BY_COUNT_DESC,
            $array['limit'] ?? self::NO_LIMIT
        );
    }
490333
public function buildAttributes($array)
    {
        $output = array();

        if ($array instanceof KObjectConfig) {
            $array = KObjectConfig::unbox($array);
        }

        if (is_array($array))
        {
            foreach ($array as $key => $item)
            {
                if (is_array($item)) {
                    $item = implode(' ', $item);
                }

                if (is_bool($item))
                {
                    if ($item === false) continue;
                    $item = $key;
                }

                $output[] = $key . '="' . str_replace('"', '&quot;', $item) . '"';
            }
        }

        return implode(' ', $output);
    }
28397
public function createWallet(array $array)
    {
        $this->formatRequest($array);
        $WSRequest = array(
            'contractNumber'           => $array['contractNumber'],
            'wallet'                   => $this->wallet($array['wallet'], $array['address'], $array['card']),
            'buyer'                    => $this->buyer($array['buyer'], $array['shippingAddress'], $array['billingAddress']),
            'owner'                    => $this->owner($array['owner'], $array['ownerAddress']),
            'privateDataList'          => $this->privateData,
            'authentication3DSecure'   => $this->authentication3DSecure($array['3DSecure']),
            'contractNumberWalletList' => $array['walletContracts']
        );
        return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'createWallet');
    }
509622
private function buildUserAgent($array)
    {
        $result = [];
        foreach ($array as $userAgent => $rules) {
            $rules = $this->arrayMergeRecursiveEx(self::TEMPLATE_SUB, $rules);
            $result = array_merge(
                $result,
                [self::DIRECTIVE_USER_AGENT . ':' . $userAgent],
                $this->buildString($rules[self::DIRECTIVE_ROBOT_VERSION], self::DIRECTIVE_ROBOT_VERSION),
                $this->buildVisitTime($rules[self::DIRECTIVE_VISIT_TIME]),
                $this->buildArray($rules[self::DIRECTIVE_NO_INDEX], self::DIRECTIVE_NO_INDEX),
                $this->buildArray($rules[self::DIRECTIVE_DISALLOW], self::DIRECTIVE_DISALLOW),
                $this->buildArray($rules[self::DIRECTIVE_ALLOW], self::DIRECTIVE_ALLOW),
                $this->buildString($rules[self::DIRECTIVE_CRAWL_DELAY], self::DIRECTIVE_CRAWL_DELAY),
                $this->buildString($rules[self::DIRECTIVE_CACHE_DELAY], self::DIRECTIVE_CACHE_DELAY),
                $this->buildRequestRate($rules[self::DIRECTIVE_REQUEST_RATE]),
                $this->buildArray($rules[self::DIRECTIVE_COMMENT], self::DIRECTIVE_COMMENT)
            );
        }
        return $result;
    }
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;
    }
979615
public static function fromArray($array=array())
    {
        $className = get_called_class();

        // hack that uses object deserialization to bypass constructor
        $object = unserialize(sprintf('O:%d:"%s":0:{}',
            strlen($className),
            $className));

        $object->_data = $array;
        $object->_saved = true;

        return $object;
    }
603771
public static function buildObject($array) {
		$obj = new \stdClass();

		foreach ($array as $key => $value) {
			if (is_array($value)) {
				$obj->{$key} = self::buildObject($value);
			} else {
				$obj->{$key} = $value;
			}
		}

		return $obj;
	}
1370069
public static function createFromArray(array $array): self
    {
        $hashMap = new self;

        foreach ($array as $key => $value) {
            $hashMap->put($key, $value);
        }

        return $hashMap;
    }
389331
public function doScoringCheque(array $array)
    {
        $WSRequest = array(
            'payment'         => $this->payment($array['payment']),
            'cheque'          => $this->cheque($array['cheque']),
            'order'           => $this->order($array['order']),
            'privateDataList' => $this->privateData
        );
        return $this->webServiceRequest($array, $WSRequest, self::DIRECT_API, 'doScoringCheque');
    }
543421
private function buildQuery($array)
    {
        $result = '';
        foreach ($array as $key => $value) {
            if (!$value)
                continue;
            if ($result)
                $result .= '&';
            if (is_array($value)) {
                foreach ($value as $subValue) {
                    if ($result)
                        $result .= '&';
                    $result .= urlencode($key) . '=' . urlencode($subValue);
                }
            } else {
                $result .= urlencode($key) . '=' . urlencode($value);
            }
        }
        return $result;
    }
476763
public function arrayToObject($array)
    {
        $object = new \stdClass();
        foreach ($array as $k => $v) {
            if (is_array($v)) {
                // load nested elements
                $v = $this->arrayToObject($v);
            }
            $object->{$k} = $v;
        }

        return $object;
    }
161952
protected function doCreateObject(array $array)
    {
        $orderItem = new WishListItem($array);
        if (isset($array['products']) && $product = reset($array['products'])) {
            $productMapper = new ProductsMapper();

            if (isset($array['images'])) {
                $product['images'] = $array['images'];
            }

            $orderItem->product = $productMapper->createObject($product);
        }

        return $orderItem;
    }
914213
public static function createFromArray(array $array)
    {
        if (
            !isset($array['uuid']) ||
            !isset($array['app_uuid'])
        ) {
            throw InvalidFormatException::tokenFormatNotValid(json_encode($array));
        }

        $token = new self(
            TokenUUID::createFromArray($array['uuid']),
            AppUUID::createFromArray($array['app_uuid']),
            array_map(function (array $indexUUIDAsArray) {
                return IndexUUID::createFromArray($indexUUIDAsArray);
            }, ($array['indices'] ?? [])),
            $array['endpoints'] ?? [],
            $array['plugins'] ?? [],
            $array['ttl'] ?? self::DEFAULT_TTL,
            $array['metadata'] ?? []
        );

        $token->createdAt = $array['created_at'];
        $token->updatedAt = $array['updated_at'];

        return $token;
    }