Passed
Push — v5.x ( 7911f3...8eee51 )
by Thierry
02:06
created

CallableClass::jq()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace Jaxon\App;
4
5
use Jaxon\App\Session\SessionInterface;
6
use Jaxon\App\View\ViewRenderer;
7
use Jaxon\Exception\SetupException;
8
use Jaxon\Plugin\Request\CallableClass\CallableClassHelper;
9
use Jaxon\Plugin\Response\DataBag\DataBagContext;
10
use Jaxon\Plugin\Response\JQuery\DomSelector;
11
use Jaxon\Plugin\Response\Pagination\Paginator;
12
use Jaxon\Request\Call\Call;
13
use Jaxon\Request\Factory\RequestFactory;
14
use Jaxon\Request\TargetInterface;
15
use Jaxon\Response\Response;
16
use Psr\Log\LoggerInterface;
17
18
class CallableClass
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class CallableClass
Loading history...
19
{
20
    /**
21
     * @var Response
22
     */
23
    protected $response = null;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
24
25
    /**
26
     * @var CallableClassHelper
27
     */
28
    protected $xCallableClassHelper = null;
29
30
    /**
31
     * Get the Jaxon request target
32
     *
33
     * @return TargetInterface
34
     */
35
    protected function target(): TargetInterface
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
36
    {
37
        return $this->xCallableClassHelper->xTarget;
38
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
39
40
    /**
41
     * Get an instance of a Jaxon class by name
42
     *
43
     * @param string $sClassName the class name
44
     *
45
     * @return mixed
46
     * @throws SetupException
47
     */
48
    public function cl(string $sClassName)
49
    {
50
        return $this->xCallableClassHelper->cl($sClassName);
51
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
52
53
    /**
54
     * Get the request factory.
55
     *
56
     * @param string $sClassName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
57
     *
58
     * @return RequestFactory
59
     */
60
    public function rq(string $sClassName = ''): RequestFactory
61
    {
62
        return $this->xCallableClassHelper->rq($sClassName);
63
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
64
65
    /**
66
     * Get the logger
67
     *
68
     * @return LoggerInterface
69
     */
70
    public function logger(): LoggerInterface
71
    {
72
        return $this->xCallableClassHelper->xLogger;
73
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
74
75
    /**
76
     * Get the view renderer
77
     *
78
     * @return ViewRenderer
79
     */
80
    public function view(): ViewRenderer
81
    {
82
        return $this->xCallableClassHelper->xViewRenderer;
83
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
84
85
    /**
86
     * Get the session manager
87
     *
88
     * @return SessionInterface
89
     */
90
    public function session(): SessionInterface
91
    {
92
        return $this->xCallableClassHelper->xSessionManager;
93
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
94
95
    /**
96
     * Get the uploaded files
97
     *
98
     * @return array
99
     */
100
    public function files(): array
101
    {
102
        return $this->xCallableClassHelper->xUploadHandler->files();
103
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
104
105
    /**
106
     * Create a JQuery DomSelector, and link it to the response attribute.
107
     *
108
     * @param string $sPath    The jQuery selector path
109
     * @param mixed $xContext    A context associated to the selector
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter type; 1 found
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
110
     *
111
     * @return DomSelector
112
     */
113
    public function jq(string $sPath = '', $xContext = null): DomSelector
114
    {
115
        return $this->response->jq($sPath, $xContext);
116
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
117
118
    /**
119
     * Get a data bag.
120
     *
121
     * @param string  $sBagName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
122
     *
123
     * @return DataBagContext
124
     */
125
    public function bag(string $sBagName): DataBagContext
126
    {
127
        return $this->response->bag($sBagName);
128
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
129
130
    /**
131
     * Create a paginator
132
     *
133
     * @param int $nCurrentPage     The current page number
0 ignored issues
show
Coding Style introduced by
Expected 2 spaces after parameter name; 5 found
Loading history...
134
     * @param int $nItemsPerPage    The number of items per page
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
135
     * @param int $nTotalItems      The total number of items
0 ignored issues
show
Coding Style introduced by
Expected 3 spaces after parameter name; 6 found
Loading history...
136
     *
137
     * @return Paginator
138
     */
139
    public function paginator(int $nCurrentPage, int $nItemsPerPage, int $nTotalItems): Paginator
140
    {
141
        return $this->response->paginator($nCurrentPage, $nItemsPerPage, $nTotalItems);
142
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
143
144
    /**
145
     * Render an HTML pagination control.
146
     *
147
     * @param Paginator $xPaginator
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
148
     * @param Call $xCall
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 6 spaces after parameter type; 1 found
Loading history...
149
     * @param string $sWrapperId
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 4 spaces after parameter type; 1 found
Loading history...
150
     *
151
     * @return void
152
     */
153
    public function paginate(Paginator $xPaginator, Call $xCall, string $sWrapperId = '')
154
    {
155
        $this->response->paginate($xPaginator, $xCall, $sWrapperId);
156
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
157
}
158