Passed
Push — master ( b86a9b...818b3e )
by Thierry
02:35
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\Request\Factory\RequestFactory;
12
use Jaxon\Response\Response;
13
use Psr\Log\LoggerInterface;
14
15
class CallableClass
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class CallableClass
Loading history...
16
{
17
    /**
18
     * @var Response
19
     */
20
    protected $response = null;
0 ignored issues
show
Coding Style introduced by
Expected 1 blank line(s) before first member var; 0 found
Loading history...
21
22
    /**
23
     * @var CallableClassHelper
24
     */
25
    protected $xCallableClassHelper = null;
26
27
    /**
28
     * Get an instance of a Jaxon class by name
29
     *
30
     * @param string $sName the class name
31
     *
32
     * @return object|null
33
     * @throws SetupException
34
     */
35
    public function cl(string $sName)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
36
    {
37
        $xCallableClass = $this->xCallableClassHelper->xCallableRegistry->getCallableObject($sName);
38
        if($xCallableClass === null)
39
        {
40
            return null;
41
        }
42
        return $xCallableClass->getRegisteredObject();
43
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
44
45
    /**
46
     * Get the request factory.
47
     *
48
     * @return RequestFactory
49
     */
50
    public function rq(): RequestFactory
51
    {
52
        return $this->xCallableClassHelper->xRequestFactory;
53
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
54
55
    /**
56
     * Get the logger
57
     *
58
     * @return LoggerInterface
59
     */
60
    public function logger(): LoggerInterface
61
    {
62
        return $this->xCallableClassHelper->xLogger;
63
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
64
65
    /**
66
     * Get the view renderer
67
     *
68
     * @return ViewRenderer
69
     */
70
    public function view(): ViewRenderer
71
    {
72
        return $this->xCallableClassHelper->xViewRenderer;
73
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
74
75
    /**
76
     * Get the session manager
77
     *
78
     * @return SessionInterface
79
     */
80
    public function session(): SessionInterface
81
    {
82
        return $this->xCallableClassHelper->xSessionManager;
83
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
84
85
    /**
86
     * Get the uploaded files
87
     *
88
     * @return array
89
     */
90
    public function files(): array
91
    {
92
        return $this->xCallableClassHelper->xUploadHandler->files();
93
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
94
95
    /**
96
     * Create a JQuery DomSelector, and link it to the response attribute.
97
     *
98
     * @param string $sPath    The jQuery selector path
99
     * @param string $sContext    A context associated to the selector
0 ignored issues
show
Coding Style introduced by
Expected 1 spaces after parameter name; 4 found
Loading history...
100
     *
101
     * @return DomSelector
102
     */
103
    public function jq(string $sPath = '', string $sContext = ''): DomSelector
104
    {
105
        return $this->response->jq($sPath, $sContext);
106
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
107
108
    /**
109
     * Get a data bag.
110
     *
111
     * @param string  $sName
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...
112
     *
113
     * @return DataBagContext
114
     */
115
    public function bag(string $sName): DataBagContext
116
    {
117
        return $this->response->bag($sName);
118
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
119
}
120