Renderers a progress bar for the backup or restore given the items that make it up.

@param array $items An array of items
@return string
498941
public function progress_bar(array $items) {
        foreach ($items as &$item) {
            $text = $item['text'];
            unset($item['text']);
            if (array_key_exists('link', $item)) {
                $link = $item['link'];
                unset($item['link']);
                $item = html_writer::link($link, $text, $item);
            } else {
                $item = html_writer::tag('span', $text, $item);
            }
        }
        return html_writer::tag('div', join(get_separator(), $items), array('class' => 'backup_progress clearfix'));
    }
827183
public function renderNested(array $items, $level = 0)
    {
        $out = '';
        foreach ($items as $item) {
            $out .= $this->_renderItem($item, $level);
        }
        return $out;
    }
831576
public function renderItems($items)
    {
        $result = '';

        // loop over subjects
        $subjectArray = [];
        foreach ($items as $subject => $subjectStatements) {
            $subjectString = $this->turtleString($subject)."\n\t";

            // loop over predicates
            $predicateArray = [];
            foreach ($subjectStatements as $predicate => $objects) {
                $predicateString = $this->turtleString($predicate).' ';

                // loop over objects
                $objectArray = [];
                foreach ($objects as $object => $properties) {
                    $objectString = '';
                    if (null === $properties) {
                        $objectString = $this->turtleString($object);
                    } else {
                        if (false === strpos($object, '"') && false === strpos($object, "\r") && false === strpos($object,
                                "\n")
                        ) {
                            $objectString = '"'.$object.'"';
                        } else {
                            if (false === strpos($object, '"""')) {
                                $objectString = '"""'.$object.'"""';
                            } else {
                                if (false === strpos($object, "'''")) {
                                    $objectString = "'''".$object."'''";
                                } else {
                                    // TODO: Error Handling for could not escape.
                                }
                            }
                        }
                        if ($properties['language']) {
                            $objectString .= '@'.$properties['language'];
                        }
                        if ($properties['type']) {
                            $objectString .= '^^'.$this->turtleString($properties['type']);
                        }
                    }
                    $objectArray[] = $objectString;
                }
                $predicateString .= implode(', ', $objectArray);
                $predicateArray[] = $predicateString;
            }

            $subjectString .= implode(" ;\n\t", $predicateArray);
            $subjectArray[] = $subjectString;
        }
        $result .= implode(' .'.PHP_EOL.PHP_EOL, $subjectArray).' .'.PHP_EOL;

        // Prepend the prefixes that are used.
        $prefixes = [];
        foreach ($this->prefixes as $acronym => $prefix) {
            if (true === $this->usedPrefixes[$acronym]) {
                $prefixes[] = '@prefix '.$acronym.': '.$this->turtleString($prefix, false).' .'.PHP_EOL;
            }
        }

        $result = PHP_EOL.implode('', $prefixes).PHP_EOL.$result;

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

        return $items;
    }
219398
protected function setReviewAttribute($items)
    {
        if (is_array($items) === false) {
            return $items;
        }

        return array_map(function ($item) {
            return $this->getNestedContext(Review::class, $item);
        }, $items);
    }
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,
        ]);
    }
1211195
public function finish(array $items = [])
    {
        foreach ($items as $item) {
            if (is_null(array_get($this->keyMap, $item))) {
                $explode = explode('.', $item);
                $this->saving($explode[0], $explode[1]);
            }
        }
        return true;
    }
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);
  }
1023072
protected function renderItem($item) {
        $linkTemplate = empty($item['items']) ? $this->linkTemplate : $this->itemSubmenuLinkTemplate;
        $labelTemplate = empty($item['items']) ? $this->labelTemplate : $this->itemSubmenuLabelTemplate;

        if (isset($item['url'])) {
            $template = ArrayHelper::getValue($item, 'template', $linkTemplate);

            $params = [
                '{url}' => Html::encode(Url::to($item['url'])),
                '{label}' => $item['label'],
                '{icon}' => isset($item['icon']) ? "<i class='{$item['icon']}'></i>" : '',
            ];

            return strtr($template, $params);
        } else {
            $template = ArrayHelper::getValue($item, 'template', $labelTemplate);

            return strtr($template, [
                '{label}' => $item['label'],
                '{icon}' => isset($item['icon']) ? "<i class='{$item['icon']}'></i>" : '',
            ]);
        }
    }
1143659
public function process(array $items)
    {
        $total = count($items);
        for ($i = 1; $i < $total; $i++) {
            for ($j = 0; $j < $total - $i; $j++) {
                if (!$items[$j]->getDate() || !$items[$j + 1]->getDate()) {
                    continue;
                }
                if ($items[$j]->getDate()->getTimestamp() > $items[$j + 1]->getDate()->getTimestamp()) {
                    continue;
                }
                $aux = $items[$j + 1];
                $items[$j + 1] = $items[$j];
                $items[$j] = $aux;
            }
        }

        return $items;
    }
60543
public function get_progress_bar() {
        global $PAGE;

        $stage = self::STAGE_COMPLETE;
        $currentstage = $this->stage->get_stage();
        $items = array();
        while ($stage > 0) {
            $classes = array('backup_stage');
            if (floor($stage / 2) == $currentstage) {
                $classes[] = 'backup_stage_next';
            } else if ($stage == $currentstage) {
                $classes[] = 'backup_stage_current';
            } else if ($stage < $currentstage) {
                $classes[] = 'backup_stage_complete';
            }
            $item = array('text' => strlen(decbin($stage)).'. '.get_string('restorestage'.$stage, 'backup'), 'class' => join(' ', $classes));
            if ($stage < $currentstage && $currentstage < self::STAGE_COMPLETE && $stage > self::STAGE_DESTINATION) {
                $item['link'] = new moodle_url($PAGE->url, array('restore' => $this->get_restoreid(), 'stage' => $stage));
            }
            array_unshift($items, $item);
            $stage = floor($stage / 2);
        }
        return $items;
    }
468839
public function prepare($items = null)
    {
        $items->each(function ($item) {
            $item->items = collect();
            if ($item->has_categories) {
                $item->items = $this->prepare(ProjectCategories::allForMenu($item->page->uri()));
            }
            $item->href = $this->setHref($item);
            $item->class = $this->setClass($item);
        });

        return $items;
    }
438159
public function getTabs(array $items, array $attrs = []): string
    {
        $attrs = HtmlAttrs::build(array_replace_recursive([
            'role' => 'tablist',
            'class' => 'nav nav-tabs',
        ], $attrs));

        return vsprintf('<ul %s>%s</ul>', [
            $attrs,
            implode('', array_map([$this, 'getTab'], $items)),
        ]);
    }
1066839
public function prepareItems($items)
    {
        if (!is_array($items)) {
            return $items;
        } elseif (self::isAssoc($items)) {
            $items = $this->prepareItem($items);
        } else {
            foreach ($items as $key => $item) {
                $items[ $key ] = $this->prepareItem($item);
            }
        }
        return $items;
    }
495197
private function buildMenuItems(array $items)
    {
        $html = '';

        foreach ($items as $item) {

            if ($this->multilevel && $item->hasChilds()) {
                $html .= '
				<li class="navbar-parent">
					<a href="' . $item->getUrl() . '">' . $item->getText() . '</a>
					<ul>';

                $html .= $this->buildMenuItems($item->getChilds());

                $html .= '
					</ul>
				</li>';
            } else {

                $url = $item->getUrl();

                if ($url) {
                    $html .= '<li><a href="' . $url . '">' . $item->getText() . '</a></li>';
                } else {
                    $html .= '<li><a href="#" onClick="return false">' . $item->getText() . '</a></li>';
                }
            }
        }

        return $html;
    }
1023416
protected function getProgressBar(Collection $models)
    {
        $output = $this->output ?: new NullOutput();
        $progress = new ProgressBar($output, $models->count());

        return $progress;
    }
1305646
public function countItems($items)
    {
        if ($this->_count) {
            return $this->_count;
        }
        $this->_count($items);

        return $this->_count;
    }