Creates a menu item from an array of data

@param array $data
@returns MenuItem
193558
public function createMenuNode($data) {
		$cls = $this->itemClass;
		$node = $cls::create($data, $this);
		$this->items[$node->ID] = $node;
		return $node;
	}
1180202
public function create(array $data = [])
    {
        $lists = new Lists();

        if (array_key_exists('items', $data)) {
            $lists->setItems(
                $this->getListItemFactory()->createCollection($data['items'])
            );
        }

        /** Images */
        if (array_key_exists('poster_path', $data)) {
            $lists->setPosterImage($this->getImageFactory()->createFromPath($data['poster_path'], 'poster_path'));
        }

        return $this->hydrate($lists, $data);
    }
456356
protected function createSectionFromArray(array $data)
    {
        $section = new Section();

        $section->id = (int)$data['id'];
        $section->name = $data['name'];
        $section->identifier = $data['identifier'];

        return $section;
    }
1191971
protected function interpretNestedGroupLayout(array $data)
    {
        foreach ($data as $key => &$value) {

            if ( ! is_array($value)) {
                continue;
            }

            // The child is a group, so make a presence object for it
            $children = array_get($value, 'children', []);
            $children = $this->interpretNestedGroupLayout($children);

            $value = new MenuPresence([
                'id'               => $key ?: array_get($value, 'id'),
                'type'             => MenuPresenceType::GROUP,
                'label'            => array_get($value, 'label'),
                'label_translated' => array_get($value, 'label_translated'),
                'icon'             => array_get($value, 'icon'),
                'children'         => $children,
            ]);
        }

        unset ($value);

        return $data;
    }
99512
public function create($data)
    {
        $seo = new SeoViewObject();

        if (empty($data)) {
            return $seo;
        }

        $seo->title = $data['title'];
        $seo->description = $data['description'];
        $seo->keywords = $data['keywords'];
        $seo->canonicalUrl = $data['canonicalUrl'];
        $seo->noIndex = $data['noIndex'];
        $seo->noFollow = $data['noFollow'];
        $seo->hideInSitemap = $data['hideInSitemap'];

        return $seo;
    }
75465
protected function createStructure( array $data )
    {
        $structure = $this->getStructureFactory()
                          ->factory( $data );

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        if ( $structure instanceof SiteInfoAwareInterface )
        {
            $structure->setSiteInfo( $this->getSiteInfo() );
        }

        if ( $structure instanceof ServiceLocatorAwareInterface )
        {
            $structure->setServiceLocator( $this->getServiceLocator() );
        }

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

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

        return $items;
    }
140406
private function createClassItem(array $data) {
    $classItem = [
      'class_id' => $data['id'],
      'category' => $data['category'],
      'location' => $data['location'],
      'title' => $data['title'],
      'description' => $this->getDescription($data),
      'start_date' => $this->getStartDate($data),
      'end_date' => $this->getEndDate($data),
      'recurring' => 'weekly',
      'studio' => $data['studio'],
      'instructor' => strip_tags($data['instructor']),
      'patterns' => [
        'day' => $this->getDay($data),
        'start_time' => $this->getStartTime($data),
        'end_time' => $this->getEndTime($data),
      ],
    ];

    return $classItem;
  }
190182
public static function fromArray(array $data): self
    {
        $fixed_list = new static();

        $fixed_list->decorated = SplFixedArray::fromArray($data, false);

        return $fixed_list;
    }
814267
public function create(array $data)
    {
        $playlistItem = new YoutubePlaylistItem();

        $snippet = $data['snippet'];

        $author = new Author();
        $author->setIdentifier($snippet['channelId']);
        $author->setName($snippet['channelTitle']);
        $author->setUsername($snippet['channelTitle']);

        $playlistItem
            ->setIdentifier($data['id'])
            ->setMessage($snippet['title'])
            ->setCreatedAt(new \DateTime($snippet['publishedAt']))
            ->setAuthor($author);

        $media = $this->getBestThumbnailRes($snippet['thumbnails']);
        $media->setLink('https://www.youtube.com/watch?v=' . $snippet['resourceId']['videoId']);

        $playlistItem->addMedia($media);

        return $playlistItem;
    }
658523
public static function fromArray(array $data = [])
    {
        $obj = new static();

        foreach ($data as $v) {
            $obj->addNode(Node::factory($v));
        }

        return $obj;
    }
599973
public function createRole(array $data = [])
    {
        $deferred = new Deferred();

        $rolePart = $this->factory->create(Role::class);

        $this->roles->save($rolePart)->then(
            function ($role) use ($deferred, $data) {
                $role->fill($data);

                $this->roles->save($role)->then(
                    function ($role) use ($deferred) {
                        $deferred->resolve($role);
                    },
                    \React\Partial\bind_right($this->reject, $deferred)
                );
            },
            \React\Partial\bind_right($this->reject, $deferred)
        );

        return $deferred->promise();
    }
336383
final public function fromArray(Array $data): self
    {
        foreach ($data as $key => $value) {
            $method = 'set' . ucfirst($key);

            if (method_exists($this, $method)) {
                $this->$method($value);
            }
        }

        return $this;
    }
29956
public function create(array $data)
    {
        $channelItem = new YoutubeChannelItem();

        $snippet = $data['snippet'];

        $author = new Author();
        $author->setIdentifier($snippet['channelId']);
        $author->setName($data['channelTitle']);
        $author->setUsername($data['channelTitle']);

        $channelItem
            ->setIdentifier($data['id']['videoId'])
            ->setMessage($snippet['description'])
            ->setCreatedAt(new \DateTime($snippet['publishedAt']))
            ->setAuthor($author);

        $media = $this->getBestThumbnailRes($snippet['thumbnails']);
        $media->setLink('https://www.youtube.com/watch?v=' . $data['id']['videoId']);

        $channelItem->addMedia($media);

        return $channelItem;
    }
948043
public static function make(array $data = array())
    {
        if (static::isFileOrFolder($data)) {
            $tag = $data['.tag'];

            //File
            if (static::isFile($tag)) {
                return new FileMetadata($data);
            }

            //Folder
            if (static::isFolder($tag)) {
                return new FolderMetadata($data);
            }
        }

        //Temporary Link
        if (static::isTemporaryLink($data)) {
            return new TemporaryLink($data);
        }

        //List
        if (static::isList($data)) {
            return new MetadataCollection($data);
        }

        //Search Results
        if (static::isSearchResult($data)) {
            return new SearchResults($data);
        }

        //Deleted File/Folder
        if (static::isDeletedFileOrFolder($data)) {
            return new DeletedMetadata($data);
        }

        //Base Model
        return new BaseModel($data);
    }
280172
public function addMenuItem(string $k, array $data)
    {
        // Can not be added if disabled
        if (!$this->isAddingItemsAllowed()) {
            return $this;
        }

        // Add to menu
        $this->_menu[$k] = $data;

        return $this;
    }
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;
    }