CallableClass::_initCallable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Jaxon\App;
4
5
use Jaxon\Di\Container;
6
use Jaxon\Plugin\Request\CallableClass\CallableClassHelper;
7
use Jaxon\Plugin\Response\Pagination\Paginator;
8
use Jaxon\Response\AjaxResponse;
9
use Jaxon\Response\Response;
10
11
class CallableClass extends AbstractCallable
12
{
13
    /**
14
     * @var Response
15
     */
16
    protected $response = null;
17
18
    /**
19
     * @inheritDoc
20
     */
21
    public function _initCallable(Container $di, CallableClassHelper $xHelper)
22
    {
23
        $this->xHelper = $xHelper;
24
        $this->response = $di->getResponse();
25
    }
26
27
    /**
28
     * @inheritDoc
29
     */
30
    final protected function _response(): AjaxResponse
31
    {
32
        return $this->response;
33
    }
34
35
    /**
36
     * Create a paginator.
37
     *
38
     * @param int $nPageNumber     The current page number
39
     * @param int $nItemsPerPage    The number of items per page
40
     * @param int $nTotalItems      The total number of items
41
     *
42
     * @return Paginator
43
     */
44
    final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator
45
    {
46
        return $this->_response()->paginator($nPageNumber, $nItemsPerPage, $nTotalItems);
47
    }
48
}
49