Create from array.

@param array $array

@return Filter
554886
public static function createFromArray(array $array): self
    {
        if (
            isset($array['values']) &&
            !is_array($array['values'])
        ) {
            throw InvalidFormatException::queryFormatNotValid($array);
        }

        return self::create(
            $array['field'] ?? 'uuid.type',
            $array['values'] ?? [],
            (int) ($array['application_type'] ?? self::AT_LEAST_ONE),
            $array['filter_type'] ?? self::TYPE_FIELD,
            $array['filter_terms'] ?? []
        );
    }
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;
    }
905182
protected function doCreateObject(array $array)
    {
        $catalogItem                 = new CatalogItem($array);
        $catalogItem->filterSettings = json_decode((string)$catalogItem->filterSettings, true);

        return $catalogItem;
    }
1004753
protected function card(array $array)
    {
        $card = new Card();
        if ($array) {
            foreach ($array as $k => $v) {
                if (array_key_exists($k, $card) && (strlen($v))) {
                    $card->$k = $v;
                }
            }
        }
        $card->paymentData = null;
        if (isset($array['paymentData'])) {
            $card->paymentData = $this->paymentData($array['paymentData']);
        }
        return new \SoapVar($card, SOAP_ENC_OBJECT, self::SOAP_CARD, self::PAYLINE_NAMESPACE);
    }
49997
public static function createFromArray(array $array)
    {
        self::$instance = new Collector;

        self::$instance->buffer = null;

        $spreadsheet = new Spreadsheet();
        $spreadsheet->getActiveSheet()
            ->fromArray(
                $array,  // os dados a adicionar
                NULL     // itens com este valor não serão setados
            );

        self::$instance->buffer = $spreadsheet;

        self::$instance->debug_info = ['created_with' => __METHOD__];

        return self::$instance;
    }
981995
protected function doCreateObject(array $array)
    {
        $attribute = new Attribute(isset($array['attributes']) && is_array($array['attributes']) ? $array['attributes'] : $array);
        if (isset($array['attributeValues'])) {
            $mapper = new AttributeValuesMapper();
            foreach ($array['attributeValues'] as $item) {
                $attribute->values[] = $mapper->createObject($item);
            }
        }

        if (isset($array['attributeGroups'])) {
            $mapper           = new AttributeGroupsMapper();
            $attribute->group = $mapper->createObject($array['attributeGroups']);
        }


        return $attribute;
    }
1164492
public function arrayCopy(array $array)
    {
        $copy = [];

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $copy[ $key ] = $this->arrayCopy($value);
            } elseif (is_object($value)) {
                $copy[ $key ] = clone $value;
            } else {
                $copy[ $key ] = $value;
            }
        }

        return $copy;
    }
354581
protected function doCreateObject(array $array)
    {
        $orderItem = new OrderItem(isset($array['attributes']) && is_array($array['attributes']) ? $array['attributes'] : $array);
        if (isset($array['relationships']['products'])) {
            $mapper = new ProductsMapper();
            foreach ($array['relationships']['products'] as $item) {
                $product            = array_merge($item['attributes'], $item['relationships']);
                $orderItem->product = $mapper->createObject($product);
            }
        }

        // old structure
        if (isset($array['products'][0])) {
            if (isset($array['images'])) {
                $array['products'][0]['images'] = $array['images'];
            }
            $productMapper      = new ProductsMapper();
            $orderItem->product = $productMapper->createObject($array['products'][0]);
        }

        return $orderItem;
    }
508929
public static function fromObjects($array, $key) {
        $elements = array();
        foreach ($array as $element) {
            $result = call_user_func(array($element, $key));
            $elements = array_merge($elements, is_array($result) ? $result : array($result));
        }
        return new self($elements);
    }
241055
protected function filterResults(array $array)
    {
        $curWord = $this->context->getCurrentWord();

        return array_filter($array, function($val) use ($curWord) {
            return fnmatch($curWord.'*', $val);
        });
    }
493043
protected function createFilter(array $data = null)
    {
        $filter = new static();
        if ($data !== null) {
            $filter->setData($data);
        }
        return $filter;
    }
490374
public static function fromPairs($array)
    {
        if (!is_array($array) && !($array instanceof \Traversable)) {
            throw new \InvalidArgumentException(sprintf(
                'Dictionary::fromPairs() argument must be array or Traversable, '
                . 'but is "%s".', gettype($array)
            ));
        }
        
        $result = new Dictionary();
        foreach ($array as $pair) {
            if (!is_array($pair) || !isset($pair[0]) || !isset($pair[1])) {
                throw new \InvalidArgumentException(
                    'Each element of array or Traversable passed to Dictionary::FromPairs()'
                    . ' must be two-elements array.'
                );
            }
            
            $result[$pair[0]] = $pair[1];
        }
        return $result;
    }
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();
                }
            }
        }
    }
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;
    }
697308
protected function order(array $array)
    {
        $order = new Order();
        if ($array) {
            foreach ($array as $k => $v) {
                if (array_key_exists($k, $order) && (strlen($v))) {
                    $order->$k = $v;
                }
            }
        }
        // insert orderDetails
        $order->details = $this->orderDetails;
        return new \SoapVar($order, SOAP_ENC_OBJECT, self::SOAP_ORDER, self::PAYLINE_NAMESPACE);
    }
480255
public function fromArray($array) {
        if ($array instanceof Record) {
            $array = $array->toArray('', false);
        }
        foreach ($array as $key => $value) {
            if (isset($value)) {
                if($value instanceof Search){
                    $value=$value->value();
                }
                $this->$key = $value;
            }
        }
    }
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;
    }