Passed
Push — v5.x ( 4cf44b...6eb5e2 )
by Thierry
02:02
created

CallableClass::bag()   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 1
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\Factory\RequestFactory;
13
use Jaxon\Request\TargetInterface;
14
use Jaxon\Response\Response;
15
use Psr\Log\LoggerInterface;
16
17
class CallableClass
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class CallableClass
Loading history...
18
{
19
    /**
20
     * @var Response
21
     */
22
    protected $response = null;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
23
24
    /**
25
     * @var CallableClassHelper
26
     */
27
    protected $xCallableClassHelper = null;
28
29
    /**
30
     * Get the Jaxon request target
31
     *
32
     * @return TargetInterface
33
     */
34
    protected function target(): TargetInterface
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
35
    {
36
        return $this->xCallableClassHelper->xTarget;
37
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
38
39
    /**
40
     * Get an instance of a Jaxon class by name
41
     *
42
     * @param string $sClassName the class name
43
     *
44
     * @return mixed
45
     * @throws SetupException
46
     */
47
    public function cl(string $sClassName)
48
    {
49
        return $this->xCallableClassHelper->cl($sClassName);
50
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
51
52
    /**
53
     * Get the request factory.
54
     *
55
     * @param string $sClassName
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
56
     *
57
     * @return RequestFactory
58
     */
59
    public function rq(string $sClassName = ''): RequestFactory
60
    {
61
        return $this->xCallableClassHelper->rq($sClassName);
62
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
63
64
    /**
65
     * Get the logger
66
     *
67
     * @return LoggerInterface
68
     */
69
    public function logger(): LoggerInterface
70
    {
71
        return $this->xCallableClassHelper->xLogger;
72
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
73
74
    /**
75
     * Get the view renderer
76
     *
77
     * @return ViewRenderer
78
     */
79
    public function view(): ViewRenderer
80
    {
81
        return $this->xCallableClassHelper->xViewRenderer;
82
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
83
84
    /**
85
     * Get the session manager
86
     *
87
     * @return SessionInterface
88
     */
89
    public function session(): SessionInterface
90
    {
91
        return $this->xCallableClassHelper->xSessionManager;
92
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
93
94
    /**
95
     * Get the uploaded files
96
     *
97
     * @return array
98
     */
99
    public function files(): array
100
    {
101
        return $this->xCallableClassHelper->xUploadHandler->files();
102
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
103
104
    /**
105
     * Create a JQuery DomSelector, and link it to the response attribute.
106
     *
107
     * @param string $sPath    The jQuery selector path
108
     * @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...
109
     *
110
     * @return DomSelector
111
     */
112
    public function jq(string $sPath = '', $xContext = null): DomSelector
113
    {
114
        return $this->response->jq($sPath, $xContext);
115
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
116
117
    /**
118
     * Get a data bag.
119
     *
120
     * @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...
121
     *
122
     * @return DataBagContext
123
     */
124
    public function bag(string $sBagName): DataBagContext
125
    {
126
        return $this->response->bag($sBagName);
127
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
128
129
    /**
130
     * Render an HTML pagination control.
131
     *
132
     * @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...
133
     * @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...
134
     * @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...
135
     *
136
     * @return Paginator
137
     */
138
    public function paginator(int $nCurrentPage, int $nItemsPerPage, int $nTotalItems): Paginator
139
    {
140
        return $this->response->paginator($nCurrentPage, $nItemsPerPage, $nTotalItems);
141
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
142
}
143