@@ -16,7 +16,6 @@ |
||
16 | 16 | |
17 | 17 | use Lemon\Event\EventDispatcher; |
18 | 18 | use Jaxon\Sentry\View\Renderer; |
19 | - |
|
20 | 19 | use Jaxon\Request\Support\CallableRepository; |
21 | 20 | |
22 | 21 | class Container |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public static function getInstance() |
34 | 34 | { |
35 | - if(!self::$xInstance) |
|
35 | + if (!self::$xInstance) |
|
36 | 36 | { |
37 | 37 | self::$xInstance = new Container(); |
38 | 38 | } |
@@ -92,27 +92,27 @@ discard block |
||
92 | 92 | * Managers |
93 | 93 | */ |
94 | 94 | // Callable objects repository |
95 | - $this->coreContainer[CallableRepository::class] = function ($c) { |
|
95 | + $this->coreContainer[CallableRepository::class] = function($c) { |
|
96 | 96 | return new CallableRepository(); |
97 | 97 | }; |
98 | 98 | // Plugin Manager |
99 | - $this->coreContainer['jaxon.core.plugin_manager'] = function ($c) { |
|
99 | + $this->coreContainer['jaxon.core.plugin_manager'] = function($c) { |
|
100 | 100 | return new \Jaxon\Plugin\Manager(); |
101 | 101 | }; |
102 | 102 | // Request Manager |
103 | - $this->coreContainer['jaxon.core.request_manager'] = function ($c) { |
|
103 | + $this->coreContainer['jaxon.core.request_manager'] = function($c) { |
|
104 | 104 | return new \Jaxon\Request\Manager(); |
105 | 105 | }; |
106 | 106 | // Request Factory |
107 | - $this->coreContainer['jaxon.core.request_factory'] = function ($c) { |
|
107 | + $this->coreContainer['jaxon.core.request_factory'] = function($c) { |
|
108 | 108 | return new \Jaxon\Factory\Request($c[CallableRepository::class]); |
109 | 109 | }; |
110 | 110 | // Parameter Factory |
111 | - $this->coreContainer['jaxon.core.parameter_factory'] = function ($c) { |
|
111 | + $this->coreContainer['jaxon.core.parameter_factory'] = function($c) { |
|
112 | 112 | return new \Jaxon\Factory\Parameter(); |
113 | 113 | }; |
114 | 114 | // Response Manager |
115 | - $this->coreContainer['jaxon.core.response_manager'] = function ($c) { |
|
115 | + $this->coreContainer['jaxon.core.response_manager'] = function($c) { |
|
116 | 116 | return new \Jaxon\Response\Manager(); |
117 | 117 | }; |
118 | 118 | |
@@ -120,35 +120,35 @@ discard block |
||
120 | 120 | * Services |
121 | 121 | */ |
122 | 122 | // Config manager |
123 | - $this->coreContainer['jaxon.core.config'] = function ($c) { |
|
123 | + $this->coreContainer['jaxon.core.config'] = function($c) { |
|
124 | 124 | return new \Jaxon\Utils\Config\Config(); |
125 | 125 | }; |
126 | 126 | // Minifier |
127 | - $this->coreContainer['jaxon.core.minifier'] = function ($c) { |
|
127 | + $this->coreContainer['jaxon.core.minifier'] = function($c) { |
|
128 | 128 | return new \Jaxon\Utils\Template\Minifier(); |
129 | 129 | }; |
130 | 130 | // Translator |
131 | - $this->coreContainer['jaxon.core.translator'] = function ($c) { |
|
131 | + $this->coreContainer['jaxon.core.translator'] = function($c) { |
|
132 | 132 | return new \Jaxon\Utils\Translation\Translator($c['jaxon.core.translation_dir'], $c['jaxon.core.config']); |
133 | 133 | }; |
134 | 134 | // Template engine |
135 | - $this->coreContainer['jaxon.core.template'] = function ($c) { |
|
135 | + $this->coreContainer['jaxon.core.template'] = function($c) { |
|
136 | 136 | return new \Jaxon\Utils\Template\Template($c['jaxon.core.template_dir']); |
137 | 137 | }; |
138 | 138 | // Validator |
139 | - $this->coreContainer['jaxon.core.validator'] = function ($c) { |
|
139 | + $this->coreContainer['jaxon.core.validator'] = function($c) { |
|
140 | 140 | return new \Jaxon\Utils\Validation\Validator($c['jaxon.core.translator'], $c['jaxon.core.config']); |
141 | 141 | }; |
142 | 142 | // Pagination Renderer |
143 | - $this->coreContainer['jaxon.pagination.renderer'] = function ($c) { |
|
143 | + $this->coreContainer['jaxon.pagination.renderer'] = function($c) { |
|
144 | 144 | return new \Jaxon\Utils\Pagination\Renderer(); |
145 | 145 | }; |
146 | 146 | // Pagination Paginator |
147 | - $this->coreContainer['jaxon.pagination.paginator'] = function ($c) { |
|
147 | + $this->coreContainer['jaxon.pagination.paginator'] = function($c) { |
|
148 | 148 | return new \Jaxon\Utils\Pagination\Paginator($c['jaxon.pagination.renderer']); |
149 | 149 | }; |
150 | 150 | // Event Dispatcher |
151 | - $this->coreContainer['jaxon.core.events'] = function ($c) { |
|
151 | + $this->coreContainer['jaxon.core.events'] = function($c) { |
|
152 | 152 | return new EventDispatcher(); |
153 | 153 | }; |
154 | 154 | |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | * Core library objects |
157 | 157 | */ |
158 | 158 | // Global Response |
159 | - $this->coreContainer['jaxon.core.response'] = function ($c) { |
|
159 | + $this->coreContainer['jaxon.core.response'] = function($c) { |
|
160 | 160 | return new \Jaxon\Response\Response(); |
161 | 161 | }; |
162 | 162 | // Jaxon Core |
163 | - $this->coreContainer['jaxon.core.jaxon'] = function ($c) { |
|
163 | + $this->coreContainer['jaxon.core.jaxon'] = function($c) { |
|
164 | 164 | return new \Jaxon\Jaxon(); |
165 | 165 | }; |
166 | 166 | // View Renderer Facade |
167 | - $this->coreContainer['jaxon.sentry.view.renderer'] = function ($c) { |
|
167 | + $this->coreContainer['jaxon.sentry.view.renderer'] = function($c) { |
|
168 | 168 | $aRenderers = $c['jaxon.view.data.renderers']; |
169 | 169 | $sDefaultNamespace = $c['jaxon.view.data.namespace.default']; |
170 | 170 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function get($sClass) |
180 | 180 | { |
181 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
181 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
182 | 182 | { |
183 | 183 | return $this->sentryContainer->get($sClass); |
184 | 184 | } |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
464 | 464 | |
465 | 465 | // Return the initialized view renderer |
466 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
466 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
467 | 467 | // Get the defined renderer |
468 | 468 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
469 | 469 | // Init the renderer with the template namespaces |
470 | 470 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
471 | - if(key_exists($sId, $aNamespaces)) |
|
471 | + if (key_exists($sId, $aNamespaces)) |
|
472 | 472 | { |
473 | - foreach($aNamespaces[$sId] as $ns) |
|
473 | + foreach ($aNamespaces[$sId] as $ns) |
|
474 | 474 | { |
475 | 475 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
476 | 476 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function getViewRenderer($sId = '') |
490 | 490 | { |
491 | - if(!$sId) |
|
491 | + if (!$sId) |
|
492 | 492 | { |
493 | 493 | // Return the view renderer facade |
494 | 494 | return $this->coreContainer['jaxon.sentry.view.renderer']; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * The class constructor |
44 | 44 | * |
45 | - * @param CallableRepository $repository |
|
45 | + * @param CallableRepository $xRepository |
|
46 | 46 | */ |
47 | 47 | public function __construct(CallableRepository $xRepository) |
48 | 48 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @param string|null $sClass The callable class |
56 | 56 | * |
57 | - * @return Factory |
|
57 | + * @return Request |
|
58 | 58 | */ |
59 | 59 | public function setClassName($sClass) |
60 | 60 | { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @param CallableObject $xCallable The callable object |
84 | 84 | * |
85 | - * @return Factory |
|
85 | + * @return Request |
|
86 | 86 | */ |
87 | 87 | public function setCallable(CallableObject $xCallable) |
88 | 88 | { |
@@ -95,7 +95,6 @@ discard block |
||
95 | 95 | * Return the javascript call to a Jaxon function or object method |
96 | 96 | * |
97 | 97 | * @param string $sFunction The function or method (without class) name |
98 | - * @param ... $xParams The parameters of the function or method |
|
99 | 98 | * |
100 | 99 | * @return \Jaxon\Request\Request |
101 | 100 | */ |
@@ -124,7 +123,6 @@ discard block |
||
124 | 123 | * Return the javascript call to a generic function |
125 | 124 | * |
126 | 125 | * @param string $sFunction The function or method (with class) name |
127 | - * @param ... $xParams The parameters of the function or method |
|
128 | 126 | * |
129 | 127 | * @return \Jaxon\Request\Request |
130 | 128 | */ |
@@ -148,7 +146,6 @@ discard block |
||
148 | 146 | * @param integer $nItemsPerPage The number of items per page page |
149 | 147 | * @param integer $nCurrentPage The current page |
150 | 148 | * @param string $sMethod The name of function or a method prepended with its class name |
151 | - * @param ... $xParams The parameters of the function or method |
|
152 | 149 | * |
153 | 150 | * @return string the pagination links |
154 | 151 | */ |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | $this->sPrefix = $this->getOption('core.prefix.function'); |
62 | 62 | |
63 | 63 | $sClass = trim($sClass, '.\\ '); |
64 | - if(!$sClass) |
|
64 | + if (!$sClass) |
|
65 | 65 | { |
66 | 66 | return $this; |
67 | 67 | } |
68 | 68 | |
69 | - if(!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
69 | + if (!($xCallable = $this->xRepository->getCallableObject($sClass))) |
|
70 | 70 | { |
71 | 71 | // Todo: decide which of these values to return |
72 | 72 | // return null; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | array_shift($aArguments); |
108 | 108 | |
109 | 109 | // Makes legacy code works |
110 | - if(strpos($sFunction, '.') !== false) |
|
110 | + if (strpos($sFunction, '.') !== false) |
|
111 | 111 | { |
112 | 112 | // If there is a dot in the name, then it is a call to a class |
113 | 113 | $this->sPrefix = $this->getOption('core.prefix.class'); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | /** |
56 | 56 | * The class constructor |
57 | 57 | * |
58 | - * @param CallableRepository $repository |
|
58 | + * @param CallableRepository $xRepository |
|
59 | 59 | */ |
60 | 60 | public function __construct(CallableRepository $xRepository) |
61 | 61 | { |
@@ -61,19 +61,19 @@ discard block |
||
61 | 61 | { |
62 | 62 | $this->xRepository = $xRepository; |
63 | 63 | |
64 | - if(!empty($_GET['jxncls'])) |
|
64 | + if (!empty($_GET['jxncls'])) |
|
65 | 65 | { |
66 | 66 | $this->sRequestedClass = $_GET['jxncls']; |
67 | 67 | } |
68 | - if(!empty($_GET['jxnmthd'])) |
|
68 | + if (!empty($_GET['jxnmthd'])) |
|
69 | 69 | { |
70 | 70 | $this->sRequestedMethod = $_GET['jxnmthd']; |
71 | 71 | } |
72 | - if(!empty($_POST['jxncls'])) |
|
72 | + if (!empty($_POST['jxncls'])) |
|
73 | 73 | { |
74 | 74 | $this->sRequestedClass = $_POST['jxncls']; |
75 | 75 | } |
76 | - if(!empty($_POST['jxnmthd'])) |
|
76 | + if (!empty($_POST['jxnmthd'])) |
|
77 | 77 | { |
78 | 78 | $this->sRequestedMethod = $_POST['jxnmthd']; |
79 | 79 | } |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function register($sType, $sClassName, $aOptions) |
102 | 102 | { |
103 | - if($sType != $this->getName()) |
|
103 | + if ($sType != $this->getName()) |
|
104 | 104 | { |
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - if(!is_string($sClassName)) |
|
108 | + if (!is_string($sClassName)) |
|
109 | 109 | { |
110 | 110 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
111 | 111 | } |
112 | - if(is_string($aOptions)) |
|
112 | + if (is_string($aOptions)) |
|
113 | 113 | { |
114 | 114 | $aOptions = ['include' => $aOptions]; |
115 | 115 | } |
116 | - if(!is_array($aOptions)) |
|
116 | + if (!is_array($aOptions)) |
|
117 | 117 | { |
118 | 118 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
119 | 119 | } |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | public function canProcessRequest() |
152 | 152 | { |
153 | 153 | // Check the validity of the class name |
154 | - if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
154 | + if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) |
|
155 | 155 | { |
156 | 156 | $this->sRequestedClass = null; |
157 | 157 | $this->sRequestedMethod = null; |
158 | 158 | } |
159 | 159 | // Check the validity of the method name |
160 | - if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
160 | + if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod)) |
|
161 | 161 | { |
162 | 162 | $this->sRequestedClass = null; |
163 | 163 | $this->sRequestedMethod = null; |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function processRequest() |
174 | 174 | { |
175 | - if(!$this->canProcessRequest()) |
|
175 | + if (!$this->canProcessRequest()) |
|
176 | 176 | { |
177 | 177 | return false; |
178 | 178 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | // Find the requested method |
183 | 183 | $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); |
184 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
184 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
185 | 185 | { |
186 | 186 | // Unable to find the requested object or method |
187 | 187 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -53,7 +53,7 @@ |
||
53 | 53 | /** |
54 | 54 | * The class constructor |
55 | 55 | * |
56 | - * @param CallableRepository $repository |
|
56 | + * @param CallableRepository $xRepository |
|
57 | 57 | */ |
58 | 58 | public function __construct(CallableRepository $xRepository) |
59 | 59 | { |
@@ -161,8 +161,7 @@ |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $this->xRepository->addNamespace($sNamespace, $aOptions); |
164 | - } |
|
165 | - else |
|
164 | + } else |
|
166 | 165 | { |
167 | 166 | // Use underscore as separator, so there's no need to deal with namespace |
168 | 167 | // when generating javascript code. |