Paginate

@param string $content

@return Route
168379
public function paginate($content, $index = null, $order = true, $perPage = 10)
    {
        if (!$this->isPaginated()) {
            $this
                ->contents($content, $index, $order)
                ->setPerPage($perPage)
                ->setPath($this->getPath() . '/{page}')
                ->value('page', 1)
                ->assert('page', '\d+');
        }

        return $this;
    }
837441
public function convertToVirtualUrl($content)
    {
        // 如果替换的key为空,strtr会返回false
        if (!$this->realUrl) {
            return $content;
        }
        if (is_array($content)) {
            return array_map([$this, __METHOD__], $content);
        }

        return strtr($content, [$this->realUrl => $this->virtualUrl]);
    }
1262860
private function setContent($content)
    {
        if (is_array($content))
            $this->content = $content;
        elseif (is_string($content))
            $this->content = trim($content);

        return $this;
    }
354496
public function addContent(string $content): \Symfony\Component\HttpFoundation\Response
    {
        return $this->setContent($this->getContent() . $content);
    }
560751
public function paginate(array $params)
    {

        // page
        if (isset($params[$this->getParamPage()])) {
            $this->setPage($params[$this->getParamPage()]);
        }

        return $this;
    }
909922
public function generateSearchText($content)
    {
        $content = $this->_defaultData($content);
        $content['link'] = str_replace('internal://', '', $content['link'], $count);
        if ($count > 0) {
            $paths = Path::getById($content['link']);
            $content['link'] = $paths->exists ? $paths->name : '';
        }
        return parent::generateSearchText($content['link']);
    }
49710
public function parse($content) {
        $this->_content = $content;

        $this->_parseExtends();

        if ($this->_parent != null) {
            $this->_parseExtendsMain();
        }

        $this->_parseDebugStart();
        $this->_parseExtend();
        $this->_parseInclude();
        $this->_parsePath();
        $this->_parseGravatar();
        $this->_parseAsset();
        $this->_parseUrl();
        $this->_parsePhp();
        $this->_parseLang();
        $this->_parseForeach();
        $this->_parseFor();
        $this->_parseVar();
        $this->_parseVarFunc();
        $this->_parseCondition();
        $this->_parseFunction();
        $this->_parseException();
        $this->_parseBlock();
        $this->_parseTemplate();
        $this->_parseCall();
        $this->_parseMinify();
        $this->_parseDebugEnd();

        return $this->_content;
    }
1209195
public function prepend($content)
    {
        $content = self::create($content);
        $newnodes = array();
        foreach ($this as $i => $node) {
            $refnode = $node->firstChild;
            /** @var \DOMNode $node */
            foreach ($content as $newnode) {
                /** @var \DOMNode $newnode */
                $newnode = static::importNewnode($newnode, $node, $i);
                if ($refnode === null) {
                    $node->appendChild($newnode);
                } else if ($refnode !== $newnode) {
                    $node->insertBefore($newnode, $refnode);
                }
                $newnodes[] = $newnode;
            }
        }
        $content->clear();
        $content->add($newnodes);
        return $this;
    }
667233
public function paginate($n, $current = 0, $chunk = null)
    {
        // We go a page back
        --$current;

        // Variable containing the number of jump. $jump;

        if ($current <= 0) {
            $jump = 0;

            $current = 1;
        } else {
            $jump = $n * $current;
            
            $current++;
        }

        // Saving information about where
        $where = $this->where;

        $dataBind = $this->where_data_binding;

        $data = $this->jump($jump)
            ->take($n)->get();

        // Reinitialization of where
        $this->where = $where;

        $this->where_data_binding = $dataBind;

        // We count the number of pages that remain
        $restOfPage = ceil($this->count() / $n) - $current;

        // Grouped data
        if (is_int($chunk)) {
            $data = array_chunk($data, $chunk);
        }

        // Enables automatic paging.
        $data = [
            'next' => $current >= 1 && $restOfPage > 0 ? $current + 1 : false,
            'previous' => ($current - 1) <= 0 ? 1 : ($current - 1),
            'total' => (int) ($restOfPage + $current),
            'current' => $current,
            'data' => $data
        ];

        return new Collection($data);
    }
306949
protected function paginate(array $data, Request $request)
    {
        $data = new Collection($data);
        $page = $request->get('page', 1);
        $path = $request->url();

        return new LengthAwarePaginator(
            $data->forPage($page, $this->perPage),
            $data->count(),
            $this->perPage,
            $page,
            compact('path')
        );
    }
86354
public function content($content)
    {
        if ($content instanceof Renderable) {
            $this->content = $content->render();
        } else {
            $this->content = (string) $content;
        }

        return $this;
    }
1240753
public function paginate($paginate = null)
    {
        $p = $paginate? : config('admin.paginate');

        return $this->model->paginate($p);
    }
449441
public function setContent($content)
    {
        if (! $content) {
            return $this;
        }
        if (! is_array($content)) {
            $content = array( $content );
        }
        $this->clearContent();
        foreach ($content as $child) {
            $this->addChild($child);
        }

        return $this;
    }
53190
public function prepend($content)
    {
        // Require that the response be unlocked before changing it
        $this->requireUnlocked();

        $this->body = $content . $this->body;

        return $this;
    }
79671
public function withContent($content): Response
    {
        if ($this->stream) {
            return $this;
        }

        $new = clone $this;
        $new->stream = new SwooleStream($content);
        return $new;
    }
519785
protected function processUrlTag(string &$content): void
    {
        $pattern = $this->getTagPattern('url(\s+(.+?))?' . preg_quote($this->endTag, '/') . '(.+?)' . preg_quote($this->startTag . '/url', '/'));
        $content = preg_replace_callback($pattern, function ($match) {
            $matchName = $match[2];
            $matchPath = $match[3];
            $urlAsset = Application::$app->getService('urlAsset');
            if ($matchName == '') {
                return $urlAsset->getUrl($matchPath);
            } else {
                return $urlAsset->getUrl($matchPath, $matchName);
            }
        }, $content);
    }
1166837
public function set($content)
    {
        if (is_string($content))
            $content = explode(',', $content);

        if ( ! is_array($content))
            $content = (array) $content;

        $this->content = array_map(function ($keyword) {
            return $this->clean($keyword);
        }, $content);

        return $this;
    }