LaravelBook\Laravel4Powerpack\HTML::listing PHP Method

listing() private method

Generate an ordered or un-ordered list.
private listing ( string $type, array $list, array $attributes = [] ) : string
$type string
$list array
$attributes array
return string
    private function listing($type, $list, $attributes = array())
    {
        $html = '';
        if (count($list) == 0) {
            return $html;
        }
        foreach ($list as $key => $value) {
            // If the value is an array, we will recurse the function so that we can
            // produce a nested list within the list being built. Of course, nested
            // lists may exist within nested lists, etc.
            if (is_array($value)) {
                if (is_int($key)) {
                    $html .= $this->listing($type, $value);
                } else {
                    $html .= '<li>' . $key . $this->listing($type, $value) . '</li>';
                }
            } else {
                $html .= '<li>' . $this->entities($value) . '</li>';
            }
        }
        return '<' . $type . $this->attributes($attributes) . '>' . $html . '</' . $type . '>';
    }