Output table format
@param array $items
323474
protected function outputFormatTableUser(array $items)
    {
        $header = array(
            $this->text('ID'),
            $this->text('Name'),
            $this->text('E-mail'),
            $this->text('Role'),
            $this->text('Store'),
            $this->text('Enabled'),
            $this->text('Created'),
        );

        $rows = array();

        foreach ($items as $item) {
            $rows[] = array(
                $item['user_id'],
                $item['name'],
                $item['email'],
                $item['role_id'],
                $item['store_id'],
                empty($item['status']) ? $this->text('No') : $this->text('Yes'),
                $this->date($item['created'])
            );
        }

        $this->outputFormatTable($rows, $header);
    }
441737
public function process(array $items)
    {
        foreach ($items as $key => $item) {
            $items[$key] = $this->removeStyle($item);
        }

        return $items;
    }
956999
protected function renderItems($_items = NULL) {
		$_items = is_null($_items) ? $this->items : $_items;
		$items = '';
        $dataid = 0;
		foreach ($_items as $item) {
			$options = ArrayHelper::getValue($item, 'options', ['class' => 'dd-item dd3-item']);
            $options = ArrayHelper::merge($this->itemOptions, $options);
            $dataId  = ArrayHelper::getValue($item, 'id', $dataid++);
            $options = ArrayHelper::merge($options, ['data-id' => $dataId]);

            $contentOptions = ArrayHelper::getValue($item, 'contentOptions', ['class' => 'dd3-content']);
			$content = $this->handleLabel;
			$content .= Html::tag('div', ArrayHelper::getValue($item, 'content', ''), $contentOptions);

			$children = ArrayHelper::getValue($item, 'children', []);
			if (!empty($children)) {
					// recursive rendering children items
				$content .= Html::beginTag('ol', ['class' => 'dd-list']);
				$content .= $this->renderItems($children);
				$content .= Html::endTag('ol');
			}

			$items .= Html::tag('li', $content, $options) . PHP_EOL;
		}
		return $items;
	}
391537
private function formatRows(array $rows) {
        foreach ($rows as $rowIndex => $row) {
            $type = $row['type'];
            $indent = $this->indent;
            $gutter = str_repeat(' ', $this->gutter);
            $verticalSeparator = $this->verticalSeparator;

            if ($type === '@section') {
                $indent = $this->sectionIndent;
            }

            foreach ($row['cols'] as $colIndex => $col) {
                if ($colIndex === 0) {
                    $col = str_repeat(' ', $indent) . $col;
                } else {
                    $col = $gutter . $verticalSeparator . $gutter . $col;
                }

                array_set($row['cols'], $colIndex, $col);
            }

            array_set($rows, $rowIndex, $row);
        }

        return $rows;
    }
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;
    }
1173860
protected function renderAsItems($items) {
    $lines = [];
    foreach ($items as $i => $item) {
      if (isset($item['visible']) && !$item['visible']) {
        unset($items[$i]);
        continue;
      }
      if (is_string($item)) {
        $lines[] = $item;
        continue;
      }
      if (!isset($item['label'])) {
        throw new InvalidConfigException("The 'label' option is required.");
      }

      $encodeLabel = isset($item['encode']) ? $item['encode'] : $this->encodeLabels;
      $label = $encodeLabel ? Html::encode($item['label']) : $item['label'];
      $options = ArrayHelper::getValue($item, 'options', []);
      $linkOptions = ArrayHelper::getValue($item, 'linkOptions', []);
      $content = Html::a($label, ArrayHelper::getValue($item, 'url', '#'), $linkOptions);
      $lines[] = Html::tag('li', $content, $options);
    }

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

        return $items;
    }
619273
protected function _render($items, $depth = 0)
    {
        $content = '';
        $formatter = $this->config('formatter');

        foreach ($items as $item) {
            $children = '';
            if (is_array($item)) {
                $item = new Entity($item);
            }

            if ($item->has('children') && !empty($item->children) && $item->expanded) {
                $children = $this->formatTemplate('parent', [
                    'attrs' => $this->templater()->formatAttributes([
                        'class' => ($this->config('dropdown') ? 'dropdown-menu multi-level' : ''),
                        'role' => 'menu'
                    ]),
                    'content' => $this->_render($item->children, $depth + 1)
                ]);
            }

            $this->_index++;
            $info = [
                'index' => $this->_index,
                'total' => $this->_count,
                'active' => $this->Link->isActive($item),
                'depth' => $depth,
                'hasChildren' => !empty($children),
                'children' => $children,
            ];
            $content .= $formatter($item, $info);
        }

        return $content;
    }
709468
protected function toArray( array $items )
	{
		$data = [];

		foreach( $items as $item )
		{
			foreach( $item->toArray( true ) as $key => $value ) {
				$data[$key][] = $value;
			}
		}

		return $data;
	}
492449
public function printItems(...$items)
    {
        $args = func_get_args();

        if (count($args) == 0) {
            $args = $this->items;
        }

        for ($i = 0; $i < sizeof($args); $i++) {
            $data = $args[$i];

            if (is_array($data)) {
                $this->printLabelValuePairs($data);
            } elseif (is_object($data)) {
                print $data;
            } else {
                $value = $this->generateValue($data);

                if ($value !== false && $value !== null) {
                    print $value;
                } else {
                    print $this->parseStringAsTemplate($data);
                }
            }
        }
    }
278545
protected function makeTree(array &$items)
    {
        $result = [];
        $tops = [];

        /**
         * @var Entity $item
         */
        foreach ($items as $item) {
            $result[$item->getKey()] = $item;
        }

        foreach ($items as $item) {
            $parentId = $item->{$item->getParentIdColumn()};

            if (array_key_exists($parentId, $result)) {
                $result[$parentId]->appendRelation($item->getChildrenRelationIndex(), $item);
            } else {
                $tops[] = $item;
            }
        }

        return $tops;
    }
1002787
private function generateHtmlFor($items)
    {
        $this->category .= '<ol class="dd-list">';
        foreach ($items as $item) {
            $this->category .= "<li class=\"dd-item\" data-id=\"{$item->id}\">";
            $editLink = route('admin.product.category.edit', [$item->id]);
            $this->category .= <<<HTML
<div class="btn-group" role="group" aria-label="Action buttons" style="display: inline">
    <a class="btn btn-sm btn-info" style="float:left;" href="{$editLink}">
        <i class="fa fa-pencil"></i>
    </a>
    <a class="btn btn-sm btn-danger jsDeleteCategoryItem" style="float:left; margin-right: 15px;" data-item-id="{$item->id}">
       <i class="fa fa-times"></i>
    </a>
</div>
HTML;
            $this->category .= "<div class=\"dd-handle\">{$item->name}</div>";

            if ($this->hasChildren($item)) {
                $this->generateHtmlFor($item->items);
            }

            $this->category .= '</li>';
        }
        $this->category .= '</ol>';
    }
850820
protected function prepareListCart(array &$items)
    {
        foreach ($items as &$item) {
            $this->setItemUrlEntity($item, $this->store, 'product');
        }
    }
1046799
protected function syndicateFeedItems(array $items)
    {
        $messages = array();
        foreach ($items as $item) {
            $messages[] = $this->formatter->format($item);
        }

        foreach ($this->targets as $connection => $targets) {
            $this->getEventQueue($connection)->then(
                function($queue) use ($targets, $messages) {
                    foreach ($targets as $target) {
                        foreach ($messages as $message) {
                            $queue->ircPrivmsg($target, $message);
                        }
                    }
                }
            );
        }
    }
402952
protected function outputFormatTableRole(array $items)
    {
        $header = array(
            $this->text('ID'),
            $this->text('Name'),
            $this->text('Redirect'),
            $this->text('Permissions'),
            $this->text('Enabled')
        );

        $rows = array();

        foreach ($items as $item) {
            $rows[] = array(
                $item['role_id'],
                $item['name'],
                $item['redirect'],
                count($item['permissions']),
                empty($item['status']) ? $this->text('No') : $this->text('Yes')
            );
        }

        $this->outputFormatTable($rows, $header);
    }
620261
public function render($items)
    {
        $wrappers = '';

        foreach ($items as $item) {
            $wrapper = new MenuWrapper($this->config(), $this->_here);
            $wrappers .= $wrapper->render($item);
            $this->_active = $this->_active || $wrapper->active();
        }

        $this->config('group.group', $wrappers);
        return $this->formatTemplate('group', $this->config('group'));
    }
1311299
protected function _renderPart($items, $options, $attrs)
    {
        if (is_object($items) && method_exists($items, 'toArray')) {
            $arrayItems = $items->toArray();
        } else {
            $arrayItems = (array)$items;
        }

        $chunkOut = '';
        $size = round(count($arrayItems) / intval($this->config('split')));
        $chunk = array_chunk($arrayItems, $size);
        $i = 1;

        foreach ($chunk as $menu) {
            $chunkOut .= $this->formatTemplate('parent', [
                'attrs' => $this->templater()->formatAttributes(['class' => "menu-part part-{$i}"]),
                'content' => $this->_render($menu, $this->config('formatter'))
            ]);
            $i++;
        }

        return $this->formatTemplate('div', [
            'attrs' => $this->templater()->formatAttributes($attrs),
            'content' => $chunkOut,
        ]);
    }