Convert array of Items to string format.

@param Item[] $items

@return string
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));
    }
480534
public function getTree($items) {
		$tree     = array(); //格式化好的树
		$newItems = array();
		foreach ($items as $value) {
			$newItems[$value['id']] = $value;
		}
		foreach ($newItems as $key => $item) {
			if (isset($newItems[$item['pid']])) {
				$newItems[$item['pid']]['son'][] = &$newItems[$key];
			} else {
				$tree[] = &$newItems[$key];
			}
		}
		return $tree;
	}
235950
public static function toJson($items)
    {
        $data = [];
        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) . '] }';

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

        return $items;
    }
873945
protected function outputFormatTableStatus(array $items)
    {
        $header = array(
            $this->text('Name'),
            $this->text('Status')
        );

        $rows = array();

        foreach ($items as $item) {
            $rows[] = array(
                $item['title'],
                $item['status']
            );
        }

        $this->outputFormatTable($rows, $header);
    }
1286313
public static function toResults(array $items) {

        $output = [];

        foreach ($items as $current) {

            if (false === ($current instanceof Select2ItemInterface)) {
                throw new InvalidArgumentException("The item must implements Select2ItemInterface");
            }

            $output[] = [
                "id"   => $current->getSelect2ItemId(),
                "text" => $current->getSelect2ItemText(),
            ];
        }

        return $output;
    }
470086
protected function denormalize(array $items)
    {
        $shows = [];

        foreach ($items as $show) {
            $show = $this->denormalizeDetailedShow($show);
            $shows[] = $show;
        }

        return $shows;
    }
315332
public function prepend($items)
    {
        return new ResultScan(array_merge($this->parseItems($items), $this->buffered()->toArray()));
    }
1160957
public function createArray(array $items): Array_
    {
        $arrayItems = [];

        foreach ($items as $item) {
            $arrayItems[] = $this->createArrayItem($item);
        }

        return new Array_($arrayItems);
    }
29109
function IN($items)
    {
        $comma_separated_items = $this->JoinNotEmpty("','", is_array($items) ? $items : explode(',', $items));
        $count_items = substr_count($comma_separated_items, ',') + 1;

        if (trim($comma_separated_items) == '') {
            $count_items = 0;
        }

        if ($count_items > 1) {
            return " IN ('$comma_separated_items') ";
        } elseif ($count_items == 1) {
            return " = '$comma_separated_items' " ;
        } else {
            return ' IS NULL ' ;
        }
    }
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);

    }
900010
protected function getArrayItems($items)
    {
        if (is_array($items)) {
            return $items;
        } elseif ($items instanceof self) {
            return $items->all();
        }

        return (array) $items;
    }
721318
protected function renderItems($items)
	{
		$script = '';
		foreach ($items as $key => $item)
		{
			if(is_array($item))
			{
				$script = $script."'$key':[";
				foreach ($item as $value)
					$script = $script."'$value',";
				$script = $script."],";
			} else
				$script = $script."'$key':'$item',";
		}
		return $script;
	}
1214620
public static function format(array $data) {
        return array_map(function ($item) {
            $args = static::toArrOrNone($item);
            if (false !== $args) {
                return $args;
            }
            return $item;
        }, $data);
    }
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;
	}
827183
public function renderNested(array $items, $level = 0)
    {
        $out = '';
        foreach ($items as $item) {
            $out .= $this->_renderItem($item, $level);
        }
        return $out;
    }
1166136
protected function processItems(array $items)
    {
        $processedItems = [];

        foreach ($items as $entry) {
            $processedItems[] = new Account($entry);
        }

        return $processedItems;
    }