src/Controller/Plugin/PaginationBuilder.php
public function getResult($paginatorAlias = null, $formAlias = null)
    {
        if (null === $paginatorAlias) {
            $paginatorAlias = isset($this->stack['paginator']['as'])
                            ? $this->stack['paginator']['as']
                            : 'paginator';
        }

        if (null === $formAlias) {
            $formAlias = isset($this->stack['form']['as']) ? $this->stack['form']['as'] : 'searchform';
        }

        /* @var \Zend\Mvc\Controller\AbstractController $controller
         * @var \Zend\Http\Request $request */
        $result = [];
        $controller = $this->getController();
        $request = $controller->getRequest();

        $this->setParameters($request->getQuery());

        if (isset($this->stack['params'])) {
            $this->callPlugin('paginationParams', $this->stack['params']);
        }

        if (isset($this->stack['form'])) {
            $form = $this->callPlugin('searchform', $this->stack['form']);
            if (!$request->isXmlHttpRequest()) {
                $result[$formAlias] = $form;
            }
        }

        if (isset($this->stack['paginator'])) {
            $result[$paginatorAlias] = $this->callPlugin('paginator', $this->stack['paginator']);
        }

        return $result;
    }
public function getResult($paginatorAlias = null, $formAlias = null)
    {
        if (null === $paginatorAlias) {
            $paginatorAlias = isset($this->stack['paginator']['as'])
                            ? $this->stack['paginator']['as']
                            : 'paginator';
        }

        if (null === $formAlias) {
            $formAlias = isset($this->stack['form']['as']) ? $this->stack['form']['as'] : 'searchform';
        }

        /* @var \Zend\Mvc\Controller\AbstractController $controller
         * @var \Zend\Http\Request $request */
        $result = [];
        $controller = $this->getController();
        $request = $controller->getRequest();

        $this->setParameters($request->getQuery());

        if (isset($this->stack['params'])) {
            $this->callPlugin('paginationParams', $this->stack['params']);
        }

        if (isset($this->stack['form'])) {
            $form = $this->callPlugin('searchform', $this->stack['form']);
            if (!$request->isXmlHttpRequest()) {
                $result[$formAlias] = $form;
            }
        }

        if (isset($this->stack['paginator'])) {
            $result[$paginatorAlias] = $this->callPlugin('paginator', $this->stack['paginator']);
        }

        return $result;
    }
Calls the stacked plugins in the right order and returns the result array.

The returned array can directly be returned from the controller or be used to populate a
view model.

The search form plugin is only called (and thus the form only present in the result array)
if the request is NOT an ajax request. (as the  form is never rerendered on ajax requests)

@param null|string $paginatorAlias Name of the paginator in the result array
@param null|string $formAlias Name of the search form in the result array

@return array