Return data, as an array.

@param array|Collection|null $items
@return array
976112
function data($items = null): array
    {
        $this->putRetainedFilterValuesInSession();

        $items = $items ?: $this->getListData(
            EntityListQueryParams::create()
                ->setDefaultSort($this->defaultSort, $this->defaultSortDir)
                ->fillWithRequest()
                ->setDefaultFilters($this->getFilterDefaultValues())
        );

        if($items instanceof LengthAwarePaginator) {
            $page = $items->currentPage();
            $totalCount = $items->total();
            $pageSize = $items->perPage();
            $items = $items->items();
        }

        $this->addInstanceCommandsAuthorizationsToConfigForItems($items);

        $keys = $this->getDataKeys();

        return [
            "items" =>
                collect($items)
                    ->map(function($row) use($keys) {
                        // Filter model attributes on actual form fields
                        return collect($row)->only(
                            array_merge(
                                $this->entityStateAttribute ? [$this->entityStateAttribute] : [],
                                $this->multiformAttribute ? [$this->multiformAttribute] : [],
                                [$this->instanceIdAttribute],
                                $keys
                            )
                        )->all();
                    })->all()
        ] + (isset($page) ? compact('page', 'totalCount', 'pageSize') : []);
    }
272298
protected function getArrayableItems($items)
	{
		if ($items instanceof self) {
			return $items->all();
		} else if (is_array($items)) {
			return $items;
		} else if ($items instanceof Arrayable) {
			return $items->toArray();
		} else if ($items instanceof Jsonable) {
			return json_decode($items->toJson(), true);
		} else if (is_object($items) && method_exists($items, 'toArray')) {
			return $items->toArray();
		}
		return (array) $items;
	}
741254
protected function renderItems( array $items )
    {
        $renderedItems = [ ];
        foreach ($items as $index => $item) {
            $renderedItems[] = $this->renderItem( $item );
        }

        return implode( PHP_EOL, $renderedItems );
    }
278104
public static function order($items) {
		if (empty($items)) {
			return array();
		}

		$_items = array_combine(array_keys($items), Hash::extract($items, '{s}.weight'));
		asort($_items);

		foreach (array_keys($_items) as $key) {
			$_items[$key] = $items[$key];
		}

		return $items;
	}
830778
public function process(array $items)
    {
        foreach ($items as $key => $item) {
            $items[$key] = $this->setImage($item);
        }

        return $items;
    }
97090
public static function transmute($items)
    {
        if (is_array($items)) {
            return $items;
        } elseif ($items instanceof Collection) {
            return $items->all();
        }

        return (array) $items;
    }
887033
public function loadFromArray(array $items)
    {
        foreach ($items as $item) {
            if (is_array($item) && ! empty($item)) {
                $this->add($item);
            }
        }

        return $this;
    }
1008654
public final function getItems(array $keys = [])
   {
       try {
           $item = [];
           foreach ($keys as $value) {
               $item[$value] = $this->getItem($value);
           }
       } catch (InvalidArgumentException $e) {
           throw $e;
       }
       return $item;
       
   }
1072876
public static function toJson($items)
    {
/*
        $data = array();
        if (!is_array($items)) {
            $data[] = json_encode($items);
        } else {
            foreach ($items as $item) {
                $data[] = json_encode($item);
            }
        }
        $json = '{ "@context" : "http://purl.imsglobal.org/ctx/lti/v1/ContentItem", "@graph" : [' . implode(", ", $data) . '] }';
*/
        $obj = new \stdClass();
        $obj->{'@context'} = 'http://purl.imsglobal.org/ctx/lti/v1/ContentItem';
        if (!is_array($items)) {
          $obj->{'@graph'} = array();
          $obj->{'@graph'}[] = $items;
        } else {
          $obj->{'@graph'} = $items;
        }

        return json_encode($obj);

    }
100963
public function load($collection = null)
    {

        $items = array();

        $list = DB::table($this->table);

        if ($collection !== null) {
            $list = $list->where('key', 'LIKE', $collection . '%');
        }

        $list = $list->pluck('value', 'key');


        // convert dotted list back to multidimensional array
        foreach ($list as $key => $value) {
            $value = json_decode($value);
            array_set($items, $key, $value);
        }

        return $items;
    }
1307350
protected function getWidgetCollection(array $items)
    {
        if (empty($items)) {
            return '';
        }

        $item = reset($items);

        $data = array(
            'items' => $items,
            'title' => $item['collection_item']['collection_title'],
            'collection_id' => $item['collection_item']['collection_id']
        );

        return $this->render($item['collection_handler']['template']['list'], $data, true);
    }
762889
protected function getItems( $items )
	{
		if (is_array($items))
		{
			return $items;
		}
		if($items instanceof self)
		{
			return $items->getAll();
		}
		if($items instanceof Arrayable)
		{
			return $items->toArray();
		}
		if($items instanceof Jsonable)
		{
			return json_decode($items->toJson(), true);
		}
		if($items instanceof JsonSerializable)
		{
			return $items->jsonSerialize();
		}
		if($items instanceof Traversable)
		{
			return iterator_to_array($items);
		}

		return (array) $items;
	}
282319
private function _pushAll(array $items) : array
    {
        $values = $this->getValues();
        foreach($items as $item)
        {
            $values[] = $item;
        }
        return $values;
    }
136069
public function getOrderedArray($items = [])
    {
        $ordered = [];
        if (empty($items)) {
            $items = $this->_menuItems;
        }

        foreach ($items as $item) {
            $ordered[] = $item;
        }

        $ordered = Hash::sort($ordered, '{n}.priority', 'ASC');

        foreach ($ordered as &$item) {
            if (isset($item['children']) && !empty($item['children'])) {
                $item['children'] = $this->getOrderedArray($item['children']);
            }
        }

        return $ordered;
    }
480447
public function getTickets($items)
  {
    if (!count($items)) {
      return [];
    }

    $result = [];
    foreach ($items as $item) {
      $result[] = new Ticket($item);
    }

    return $result;
  }
968139
public function itemsToFormat(array $items): string
    {
        return $this->strToCSV(array_map(function (Item $item) {
            return [
                $item->getId(),
                $item->getType(),
                json_encode($item->getMetadata()),
                json_encode($item->getIndexedMetadata()),
                json_encode($item->getSearchableMetadata()),
                json_encode($item->getExactMatchingMetadata()),
                json_encode($item->getSuggest()),
                json_encode(
                    ($item->getCoordinate() instanceof Coordinate)
                        ? $item->getCoordinate()->toArray()
                        : null
                ),
            ];
        }, $items));
    }
1173350
public static function make($items)
    {
        if (is_null($items)) {
            return new static;
        }

        if ($items instanceof Collection) {
            return $items;
        }

        return new static(is_array($items) ? $items : [$items]);
    }