@@ -125,19 +125,19 @@ discard block |
||
125 | 125 | * Core library objects |
126 | 126 | */ |
127 | 127 | // Global Response |
128 | - $this->libContainer[Response::class] = function () { |
|
128 | + $this->libContainer[Response::class] = function() { |
|
129 | 129 | return new Response(); |
130 | 130 | }; |
131 | 131 | // Dialog |
132 | - $this->libContainer[Dialog::class] = function () { |
|
132 | + $this->libContainer[Dialog::class] = function() { |
|
133 | 133 | return new Dialog(); |
134 | 134 | }; |
135 | 135 | // Jaxon App |
136 | - $this->libContainer[App::class] = function () { |
|
136 | + $this->libContainer[App::class] = function() { |
|
137 | 137 | return new App(); |
138 | 138 | }; |
139 | 139 | // Jaxon App bootstrap |
140 | - $this->libContainer[Bootstrap::class] = function () { |
|
140 | + $this->libContainer[Bootstrap::class] = function() { |
|
141 | 141 | return new Bootstrap(); |
142 | 142 | }; |
143 | 143 | |
@@ -145,27 +145,27 @@ discard block |
||
145 | 145 | * Plugins |
146 | 146 | */ |
147 | 147 | // Callable objects repository |
148 | - $this->libContainer[CallableRepository::class] = function () { |
|
148 | + $this->libContainer[CallableRepository::class] = function() { |
|
149 | 149 | return new CallableRepository(); |
150 | 150 | }; |
151 | 151 | // Callable class plugin |
152 | - $this->libContainer[CallableClass::class] = function ($c) { |
|
152 | + $this->libContainer[CallableClass::class] = function($c) { |
|
153 | 153 | return new CallableClass($c[CallableRepository::class]); |
154 | 154 | }; |
155 | 155 | // Callable dir plugin |
156 | - $this->libContainer[CallableDir::class] = function ($c) { |
|
156 | + $this->libContainer[CallableDir::class] = function($c) { |
|
157 | 157 | return new CallableDir($c[CallableRepository::class]); |
158 | 158 | }; |
159 | 159 | // Callable function plugin |
160 | - $this->libContainer[CallableFunction::class] = function () { |
|
160 | + $this->libContainer[CallableFunction::class] = function() { |
|
161 | 161 | return new CallableFunction(); |
162 | 162 | }; |
163 | 163 | // File upload plugin |
164 | - $this->libContainer[FileUpload::class] = function () { |
|
164 | + $this->libContainer[FileUpload::class] = function() { |
|
165 | 165 | return new FileUpload(); |
166 | 166 | }; |
167 | 167 | // JQuery response plugin |
168 | - $this->libContainer[JQueryPlugin::class] = function () { |
|
168 | + $this->libContainer[JQueryPlugin::class] = function() { |
|
169 | 169 | return new JQueryPlugin(); |
170 | 170 | }; |
171 | 171 | |
@@ -173,45 +173,45 @@ discard block |
||
173 | 173 | * Managers |
174 | 174 | */ |
175 | 175 | // Plugin Manager |
176 | - $this->libContainer[PluginManager::class] = function () { |
|
176 | + $this->libContainer[PluginManager::class] = function() { |
|
177 | 177 | return new PluginManager(); |
178 | 178 | }; |
179 | 179 | // Request Handler |
180 | - $this->libContainer[RequestHandler::class] = function ($c) { |
|
180 | + $this->libContainer[RequestHandler::class] = function($c) { |
|
181 | 181 | return new RequestHandler($c[PluginManager::class], $c[ResponseManager::class], $c[FileUpload::class]); |
182 | 182 | }; |
183 | 183 | // Request Factory |
184 | - $this->libContainer[RequestFactory::class] = function ($c) { |
|
184 | + $this->libContainer[RequestFactory::class] = function($c) { |
|
185 | 185 | return new RequestFactory($c[CallableRepository::class]); |
186 | 186 | }; |
187 | 187 | // Parameter Factory |
188 | - $this->libContainer[ParameterFactory::class] = function () { |
|
188 | + $this->libContainer[ParameterFactory::class] = function() { |
|
189 | 189 | return new ParameterFactory(); |
190 | 190 | }; |
191 | 191 | // Response Manager |
192 | - $this->libContainer[ResponseManager::class] = function () { |
|
192 | + $this->libContainer[ResponseManager::class] = function() { |
|
193 | 193 | return new ResponseManager(); |
194 | 194 | }; |
195 | 195 | // Code Generator |
196 | - $this->libContainer[CodeGenerator::class] = function ($c) { |
|
196 | + $this->libContainer[CodeGenerator::class] = function($c) { |
|
197 | 197 | return new CodeGenerator($c[PluginManager::class], $c[TemplateEngine::class]); |
198 | 198 | }; |
199 | 199 | // View Manager |
200 | - $this->libContainer[ViewManager::class] = function () { |
|
200 | + $this->libContainer[ViewManager::class] = function() { |
|
201 | 201 | return new ViewManager(); |
202 | 202 | }; |
203 | 203 | // View Renderer |
204 | - $this->libContainer[ViewRenderer::class] = function ($c) { |
|
204 | + $this->libContainer[ViewRenderer::class] = function($c) { |
|
205 | 205 | return new ViewRenderer($c[ViewManager::class]); |
206 | 206 | }; |
207 | 207 | |
208 | 208 | /* |
209 | 209 | * Config |
210 | 210 | */ |
211 | - $this->libContainer[Config::class] = function () { |
|
211 | + $this->libContainer[Config::class] = function() { |
|
212 | 212 | return new Config(); |
213 | 213 | }; |
214 | - $this->libContainer[ConfigReader::class] = function () { |
|
214 | + $this->libContainer[ConfigReader::class] = function() { |
|
215 | 215 | return new ConfigReader(); |
216 | 216 | }; |
217 | 217 | |
@@ -219,35 +219,35 @@ discard block |
||
219 | 219 | * Services |
220 | 220 | */ |
221 | 221 | // Minifier |
222 | - $this->libContainer[Minifier::class] = function () { |
|
222 | + $this->libContainer[Minifier::class] = function() { |
|
223 | 223 | return new Minifier(); |
224 | 224 | }; |
225 | 225 | // Translator |
226 | - $this->libContainer[Translator::class] = function ($c) { |
|
226 | + $this->libContainer[Translator::class] = function($c) { |
|
227 | 227 | return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]); |
228 | 228 | }; |
229 | 229 | // Template engine |
230 | - $this->libContainer[TemplateEngine::class] = function ($c) { |
|
230 | + $this->libContainer[TemplateEngine::class] = function($c) { |
|
231 | 231 | return new TemplateEngine($c['jaxon.core.template_dir']); |
232 | 232 | }; |
233 | 233 | // Template Renderer |
234 | - $this->libContainer[TemplateRenderer::class] = function ($c) { |
|
234 | + $this->libContainer[TemplateRenderer::class] = function($c) { |
|
235 | 235 | return $c[TemplateEngine::class]; |
236 | 236 | }; |
237 | 237 | // Validator |
238 | - $this->libContainer[Validator::class] = function ($c) { |
|
238 | + $this->libContainer[Validator::class] = function($c) { |
|
239 | 239 | return new Validator($c[Translator::class], $c[Config::class]); |
240 | 240 | }; |
241 | 241 | // Pagination Paginator |
242 | - $this->libContainer[Paginator::class] = function ($c) { |
|
242 | + $this->libContainer[Paginator::class] = function($c) { |
|
243 | 243 | return new Paginator($c[PaginationRenderer::class]); |
244 | 244 | }; |
245 | 245 | // Pagination Renderer |
246 | - $this->libContainer[PaginationRenderer::class] = function ($c) { |
|
246 | + $this->libContainer[PaginationRenderer::class] = function($c) { |
|
247 | 247 | return new PaginationRenderer($c[TemplateRenderer::class]); |
248 | 248 | }; |
249 | 249 | // Event Dispatcher |
250 | - $this->libContainer[EventDispatcher::class] = function () { |
|
250 | + $this->libContainer[EventDispatcher::class] = function() { |
|
251 | 251 | return new EventDispatcher(); |
252 | 252 | }; |
253 | 253 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | */ |
260 | 260 | public function get($sClass) |
261 | 261 | { |
262 | - if($this->appContainer != null && $this->appContainer->has($sClass)) |
|
262 | + if ($this->appContainer != null && $this->appContainer->has($sClass)) |
|
263 | 263 | { |
264 | 264 | return $this->appContainer->get($sClass); |
265 | 265 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | */ |
290 | 290 | public function alias($sClass, $sAlias) |
291 | 291 | { |
292 | - $this->libContainer[$sClass] = function ($c) use ($sAlias) { |
|
292 | + $this->libContainer[$sClass] = function($c) use ($sAlias) { |
|
293 | 293 | return $c[$sAlias]; |
294 | 294 | }; |
295 | 295 | } |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function setCallableClassRequestFactory($sClassName, CallableObject $xCallableObject) |
561 | 561 | { |
562 | - $this->libContainer[$sClassName . '_RequestFactory'] = function () use ($xCallableObject) { |
|
562 | + $this->libContainer[$sClassName . '_RequestFactory'] = function() use ($xCallableObject) { |
|
563 | 563 | // $xCallableObject = $c[CallableRepository::class]->getCallableObject($sClassName); |
564 | 564 | return new CallableClassRequestFactory($xCallableObject); |
565 | 565 | }; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function before($xCallable = null) |
60 | 60 | { |
61 | - if($xCallable === null) |
|
61 | + if ($xCallable === null) |
|
62 | 62 | { |
63 | 63 | return $this->xBeforeCallback; |
64 | 64 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function after($xCallable = null) |
76 | 76 | { |
77 | - if($xCallable === null) |
|
77 | + if ($xCallable === null) |
|
78 | 78 | { |
79 | 79 | return $this->xAfterCallback; |
80 | 80 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function invalid($xCallable = null) |
92 | 92 | { |
93 | - if($xCallable === null) |
|
93 | + if ($xCallable === null) |
|
94 | 94 | { |
95 | 95 | return $this->xInvalidCallback; |
96 | 96 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | */ |
107 | 107 | public function error($xCallable = null) |
108 | 108 | { |
109 | - if($xCallable === null) |
|
109 | + if ($xCallable === null) |
|
110 | 110 | { |
111 | 111 | return $this->xErrorCallback; |
112 | 112 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function init($xCallable = null) |
124 | 124 | { |
125 | - if($xCallable === null) |
|
125 | + if ($xCallable === null) |
|
126 | 126 | { |
127 | 127 | return $this->xInitCallback; |
128 | 128 | } |
@@ -138,29 +138,29 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function configure($sName, $sValue) |
140 | 140 | { |
141 | - switch($sName) |
|
141 | + switch ($sName) |
|
142 | 142 | { |
143 | 143 | // Set the separator |
144 | 144 | case 'separator': |
145 | - if($sValue == '_' || $sValue == '.') |
|
145 | + if ($sValue == '_' || $sValue == '.') |
|
146 | 146 | { |
147 | 147 | $this->sSeparator = $sValue; |
148 | 148 | } |
149 | 149 | break; |
150 | 150 | // Set the namespace |
151 | 151 | case 'namespace': |
152 | - if(is_string($sValue)) |
|
152 | + if (is_string($sValue)) |
|
153 | 153 | { |
154 | 154 | $this->sNamespace = $sValue; |
155 | 155 | } |
156 | 156 | break; |
157 | 157 | // Set the protected methods |
158 | 158 | case 'protected': |
159 | - if(is_array($sValue)) |
|
159 | + if (is_array($sValue)) |
|
160 | 160 | { |
161 | 161 | $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue); |
162 | 162 | } |
163 | - elseif(is_string($sValue)) |
|
163 | + elseif (is_string($sValue)) |
|
164 | 164 | { |
165 | 165 | $this->aProtectedMethods[] = $sValue; |
166 | 166 | } |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | public function getMethods() |
179 | 179 | { |
180 | 180 | $aMethods = []; |
181 | - foreach($this->xReflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
181 | + foreach ($this->xReflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
182 | 182 | { |
183 | 183 | $sMethodName = $xMethod->getShortName(); |
184 | 184 | // Don't take magic __call, __construct, __destruct methods |
185 | - if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
185 | + if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__') |
|
186 | 186 | { |
187 | 187 | continue; |
188 | 188 | } |
189 | 189 | // Don't take excluded methods |
190 | - if(in_array($sMethodName, $this->aProtectedMethods)) |
|
190 | + if (in_array($sMethodName, $this->aProtectedMethods)) |
|
191 | 191 | { |
192 | 192 | continue; |
193 | 193 | } |
@@ -203,15 +203,15 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public function getRegisteredObject() |
205 | 205 | { |
206 | - if($this->xRegisteredObject == null) |
|
206 | + if ($this->xRegisteredObject == null) |
|
207 | 207 | { |
208 | 208 | $di = jaxon()->di(); |
209 | 209 | // Use the Reflection class to get the parameters of the constructor |
210 | - if(($constructor = $this->xReflectionClass->getConstructor()) != null) |
|
210 | + if (($constructor = $this->xReflectionClass->getConstructor()) != null) |
|
211 | 211 | { |
212 | 212 | $parameters = $constructor->getParameters(); |
213 | 213 | $parameterInstances = []; |
214 | - foreach($parameters as $parameter) |
|
214 | + foreach ($parameters as $parameter) |
|
215 | 215 | { |
216 | 216 | // Get the parameter instance from the DI |
217 | 217 | $parameterInstances[] = $di->get($parameter->getClass()->getName()); |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | // Initialize the object |
227 | - if($this->xRegisteredObject instanceof \Jaxon\CallableClass) |
|
227 | + if ($this->xRegisteredObject instanceof \Jaxon\CallableClass) |
|
228 | 228 | { |
229 | 229 | $this->xRegisteredObject->response = jaxon()->getResponse(); |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Run the callback for class initialisation |
233 | - if(($xCallback = $di->getRequestHandler()->getCallbackManager()->init())) |
|
233 | + if (($xCallback = $di->getRequestHandler()->getCallbackManager()->init())) |
|
234 | 234 | { |
235 | 235 | call_user_func_array($xCallback, [$this->xRegisteredObject]); |
236 | 236 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | */ |
261 | 261 | public function call($sMethod, $aArgs) |
262 | 262 | { |
263 | - if(!$this->hasMethod($sMethod)) |
|
263 | + if (!$this->hasMethod($sMethod)) |
|
264 | 264 | { |
265 | 265 | return; |
266 | 266 | } |