Creates data item object from array.

@param array $data
@return array
766199
private function createDataItems(array $data)
    {
        $items = [];
        foreach ($data as $item) {
            $items[$item['label']] = new UserDataItem(
                $item['label'],
                $item['value'],
                $item['isValid'],
                $item['isOwner']
            );
        }

        return $items;
    }
91126
protected function _toArray($data)
    {
        $array = array();

        foreach ($data as $key => $value) {
            if (is($value, 'AnDomainBehaviorSerializable')) {
                $array[$key] = $value->toSerializableArray();
            } elseif (is_array($value)) {
                $array[$key] = $this->_toArray($value);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
479107
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['username'])) {
            $self->setUsername($data['username']);
        }
        if (isset($data['name'])) {
            $self->setName($data['name']);
        }

        return $self;
    }
390364
public static function arrayToObject($data)
    {
        if (is_array($data)) {
            /*
            * Return array converted to object
            * Using __FUNCTION__ (Magic constant)
            * for recursive call
            */
            $self_name = 'self::' . __FUNCTION__;

            return (object)array_map($self_name, $data);
        } else {
            // Return object
            return $data;
        }
    }
1256490
public function create(array $data)
    {
        $data = $this->client->post(Inflector::pluralize($this->getResourceName()), [$this->getResourceName() => $data]);

        return $this->fromArray(reset($data));
    }
53494
public static function createFromArray(array $data)
    {
        $self = new self();

        if (isset($data['id'])) {
            $self->setId($data['id']);
        }
        if (isset($data['type'])) {
            $self->setType($data['type']);
        }
        if (isset($data['name'])) {
            $self->setType($data['type']);
        }
        if (isset($data['context'])) {
            $self->setContext($data['context']);
        }
        if (isset($data['notes'])) {
            $self->setNotes($data['notes']);
        }
        if (isset($data['modified'])) {
            $self->setModified($data['modified']);
        }
        if (isset($data['translated'])) {
            $self->setTranslated($data['translated']);
        }
        if (isset($data['untranslated'])) {
            $self->setUntranslated($data['untranslated']);
        }
        if (isset($data['incomplete'])) {
            $self->setIncomplate($data['incomplete']);
        }
        if (isset($data['plurals'])) {
            $self->setPlurals($data['plurals']);
        }
        if (isset($data['tags'])) {
            $self->setTags($data['tags']);
        }

        return $self;
    }
1283792
protected function asArray($data)
	{
		$array = array();

		if (is_object($data))
		{
			$data = get_object_vars($data);
		}

		foreach ($data as $k => $v)
		{
			if (is_object($v) || is_array($v))
			{
				$array[$k] = $this->asArray($v);
			}
			else
			{
				$array[$k] = $v;
			}
		}

		return $array;
	}
214034
public static function createMultiple(array $data)
    {
        $items = [];

        foreach ($data as $action) {
            $items[] = new self($action);
        }

        return $items;
    }
1330376
public function create(array $data)
    {
        $user = User::create([
            'name'                  => $data['name'],
            'email'                 => $data['email'],
            'password'              => bcrypt($data['password']),
            'birthday_at'           => $data['birthday_at'],
            'locale'                => $data['locale'],
            'gender'                => $data['gender'],
            'city'                  => $data['city'],
            'about'                 => $data['about'],
            'profession'            => $data['profession'],
            'hobbies'               => $data['hobbies'],
            'homepage'              => $data['homepage'],
            'skype'                 => $data['skype'],
            'facebook'              => $data['facebook'],
            'twitter'               => $data['twitter'],
            'main_character'        => $data['main_character'],
            'main_guild'            => $data['main_guild'],
            'favorite_race'         => $data['favorite_race'],
            'favorite_spec'         => $data['favorite_spec'],
            'favorite_instance'     => $data['favorite_instance'],
            'favorite_battleground' => $data['favorite_battleground'],
        ]);

        return $user;
    }
526890
public static function createFromArray(array $data)
    {
        $defaults = [
            'providedBy' => 'n/a',
            'latitude' => null,
            'longitude' => null,
            'bounds' => [
                'south' => null,
                'west' => null,
                'north' => null,
                'east' => null,
            ],
            'streetNumber' => null,
            'streetName' => null,
            'locality' => null,
            'postalCode' => null,
            'subLocality' => null,
            'adminLevels' => [],
            'country' => null,
            'countryCode' => null,
            'timezone' => null,
        ];

        $data = array_merge($defaults, $data);

        $adminLevels = [];
        foreach ($data['adminLevels'] as $adminLevel) {
            if (empty($adminLevel['level'])) {
                continue;
            }

            $name = $adminLevel['name'] ?? $adminLevel['code'] ?? null;
            if (empty($name)) {
                continue;
            }

            $adminLevels[] = new AdminLevel($adminLevel['level'], $name, $adminLevel['code'] ?? null);
        }

        return new static(
            $data['providedBy'],
            new AdminLevelCollection($adminLevels),
            self::createCoordinates(
                $data['latitude'],
                $data['longitude']
            ),
            self::createBounds(
                $data['bounds']['south'],
                $data['bounds']['west'],
                $data['bounds']['north'],
                $data['bounds']['east']
            ),
            $data['streetNumber'],
            $data['streetName'],
            $data['postalCode'],
            $data['locality'],
            $data['subLocality'],
            self::createCountry($data['country'], $data['countryCode']),
            $data['timezone']
        );
    }
370868
protected function fromArray( array $data )
	{
		$manager = \Aimeos\MShop::create( $this->getContext(), 'order/base' );
		$attrManager = \Aimeos\MShop::create( $this->getContext(), 'order/base/service/attribute' );

		if( isset( $data['order.base.id'] ) ) {
			$basket = $manager->load( $data['order.base.id'] )->off();
		} else {
			$basket = $manager->createItem()->off();
		}

		$basket->fromArray( $data, true );

		foreach( $basket->getProducts() as $pos => $product )
		{
			if( isset( $data['product'][$pos]['order.base.product.status'] ) ) {
				$product->setStatus( $data['product'][$pos]['order.base.product.status'] );
			}
		}

		foreach( $basket->getAddresses() as $type => $addresses )
		{
			foreach( $addresses as $pos => $address )
			{
				if( isset( $data['address'][$type][$pos] ) ) {
					$list = (array) $data['address'][$type][$pos];
					$basket->addAddress( $address->fromArray( $list, true ), $type, $pos );
				} else {
					$basket->deleteAddress( $type, $pos );
				}
			}
		}

		foreach( $basket->getServices() as $type => $services )
		{
			foreach( $services as $serviceId => $service )
			{
				$list = [];
				$attrItems = $service->getAttributeItems();

				if( isset( $data['service'][$type][$serviceId] ) )
				{
					foreach( (array) $data['service'][$type][$serviceId] as $key => $pair )
					{
						foreach( $pair as $pos => $value ) {
							$list[$pos][$key] = $value;
						}
					}

					foreach( $list as $array )
					{
						if( isset( $attrItems[$array['order.base.service.attribute.id']] ) )
						{
							$attrItem = $attrItems[$array['order.base.service.attribute.id']];
							unset( $attrItems[$array['order.base.service.attribute.id']] );
						}
						else
						{
							$attrItem = $attrManager->createItem();
						}

						$attrItem->fromArray( $array, true );
						$attrItem->setParentId( $service->getId() );

						$item = $attrManager->saveItem( $attrItem );
					}
				}

				$attrManager->deleteItems( array_keys( $attrItems ) );
			}
		}

		return $basket;
	}
454917
public static function fromArray(array $data)
    {
        $iniSections = IniParser::i()->parseArray($data);

        return self::fromIniSections($iniSections);
    }
330917
public static function createFromArray(array $data): self
    {
        $obj = new self();
        $obj->name = $data['name'];
        $obj->type = $data['type'];
        $obj->date = date_create_from_format('d.m.y H:i', sprintf('%s %s', $data['date'], $data['time']));

        if (isset($data['routeIdx'])) {
            $obj->routeIdx = $data['routeIdx'];
        }

        if (isset($data['track'])) {
            $obj->track = $data['track'];
        }

        if (isset($data['rtTrack'])) {
            $obj->rtTrack = $data['rtTrack'];
        }

        if (!$obj->track && $obj->rtTrack) {
            $obj->track = $obj->rtTrack;
        }

        if (!$obj->rtTrack && $obj->track) {
            $obj->rtTrack = $obj->track;
        }

        return $obj;
    }
310102
public function toArray(array $data = [])
    {
        return array_filter(array_merge([
            'start' => $this->start,
            'range' => $this->range,
            'sort' => $this->sort,
            'sortDir' => $this->sortDirection,
            'search' => $this->search,
            'searchNotes' => $this->searchNotes,
            'condition' => $this->condition ? json_encode($this->condition) : null
        ], $data), function ($value) {
            return $value !== null;
        });
    }
784079
public function create(array $data = [])
    {
        $model = $this->factory($data);

        $this->save($model);

        return $model;
    }
982843
public function formatToItems(string $data): array
    {
        return array_map(function (array $item) {
            $itemAsArray = [
                'uuid' => [
                    'id' => $item[0],
                    'type' => $item[1],
                ],
                'metadata' => $item[2],
                'indexed_metadata' => $item[3],
                'searchable_metadata' => $item[4],
                'exact_matching_metadata' => $item[5],
                'suggest' => $item[6],
            ];

            if (!empty($item[7])) {
                $itemAsArray['coordinate'] = $item[7];
            }

            return Item::createFromArray($itemAsArray);
        }, json_decode($data, true));
    }
1291903
final public static function fromArray(array $data = [])
    {
        $lowerNode = isset($data['lower_node']) ? self::factory($data['lower_node']) : null;
        $upperNode = isset($data['upper_node']) ? self::factory($data['upper_node']) : null;
        $exclusive = isset($data['exclusive']) ? (bool)$data['exclusive'] : false;
        return new static($lowerNode, $upperNode, $exclusive);
    }