@@ -64,19 +64,19 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->xRepository = $xRepository; |
66 | 66 | |
67 | - if(!empty($_GET['jxncls'])) |
|
67 | + if (!empty($_GET['jxncls'])) |
|
68 | 68 | { |
69 | 69 | $this->sRequestedClass = trim($_GET['jxncls']); |
70 | 70 | } |
71 | - if(!empty($_GET['jxnmthd'])) |
|
71 | + if (!empty($_GET['jxnmthd'])) |
|
72 | 72 | { |
73 | 73 | $this->sRequestedMethod = trim($_GET['jxnmthd']); |
74 | 74 | } |
75 | - if(!empty($_POST['jxncls'])) |
|
75 | + if (!empty($_POST['jxncls'])) |
|
76 | 76 | { |
77 | 77 | $this->sRequestedClass = trim($_POST['jxncls']); |
78 | 78 | } |
79 | - if(!empty($_POST['jxnmthd'])) |
|
79 | + if (!empty($_POST['jxnmthd'])) |
|
80 | 80 | { |
81 | 81 | $this->sRequestedMethod = trim($_POST['jxnmthd']); |
82 | 82 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function getTarget() |
101 | 101 | { |
102 | - if(!$this->sRequestedClass || !$this->sRequestedMethod) |
|
102 | + if (!$this->sRequestedClass || !$this->sRequestedMethod) |
|
103 | 103 | { |
104 | 104 | return null; |
105 | 105 | } |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | public function register($sType, $sClassName, $aOptions) |
119 | 119 | { |
120 | 120 | $sType = trim($sType); |
121 | - if($sType != $this->getName()) |
|
121 | + if ($sType != $this->getName()) |
|
122 | 122 | { |
123 | 123 | return false; |
124 | 124 | } |
125 | 125 | |
126 | - if(!is_string($sClassName)) |
|
126 | + if (!is_string($sClassName)) |
|
127 | 127 | { |
128 | 128 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
129 | 129 | } |
130 | - if(is_string($aOptions)) |
|
130 | + if (is_string($aOptions)) |
|
131 | 131 | { |
132 | 132 | $aOptions = ['include' => $aOptions]; |
133 | 133 | } |
134 | - if(!is_array($aOptions)) |
|
134 | + if (!is_array($aOptions)) |
|
135 | 135 | { |
136 | 136 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration')); |
137 | 137 | } |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $aCallableObjects = $this->xRepository->getCallableObjects(); |
155 | 155 | $sHash = ''; |
156 | 156 | |
157 | - foreach($aNamespaces as $sNamespace => $aOptions) |
|
157 | + foreach ($aNamespaces as $sNamespace => $aOptions) |
|
158 | 158 | { |
159 | 159 | $sHash .= $sNamespace . $aOptions['separator']; |
160 | 160 | } |
161 | - foreach($aCallableObjects as $sClassName => $xCallableObject) |
|
161 | + foreach ($aCallableObjects as $sClassName => $xCallableObject) |
|
162 | 162 | { |
163 | 163 | $sHash .= $sClassName . implode('|', $xCallableObject->getMethods()); |
164 | 164 | } |
@@ -183,21 +183,21 @@ discard block |
||
183 | 183 | |
184 | 184 | $xCallableClass = new \ReflectionClass(UserCallableClass::class); |
185 | 185 | $aCallableMethods = []; |
186 | - foreach($xCallableClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
186 | + foreach ($xCallableClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod) |
|
187 | 187 | { |
188 | 188 | $aCallableMethods[] = $xMethod->getName(); |
189 | 189 | } |
190 | 190 | |
191 | - foreach(array_keys($aNamespaces) as $sNamespace) |
|
191 | + foreach (array_keys($aNamespaces) as $sNamespace) |
|
192 | 192 | { |
193 | 193 | $offset = 0; |
194 | 194 | $sJsNamespace = str_replace('\\', '.', $sNamespace); |
195 | 195 | $sJsNamespace .= '.Null'; // This is a sentinel. The last token is not processed in the while loop. |
196 | - while(($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
196 | + while (($dotPosition = strpos($sJsNamespace, '.', $offset)) !== false) |
|
197 | 197 | { |
198 | 198 | $sJsClass = substr($sJsNamespace, 0, $dotPosition); |
199 | 199 | // Generate code for this object |
200 | - if(!key_exists($sJsClass, $aJsClasses)) |
|
200 | + if (!key_exists($sJsClass, $aJsClasses)) |
|
201 | 201 | { |
202 | 202 | $sCode .= "$sPrefix$sJsClass = {};\n"; |
203 | 203 | $aJsClasses[$sJsClass] = $sJsClass; |
@@ -206,17 +206,17 @@ discard block |
||
206 | 206 | } |
207 | 207 | } |
208 | 208 | |
209 | - foreach($aCallableObjects as $sClassName => $xCallableObject) |
|
209 | + foreach ($aCallableObjects as $sClassName => $xCallableObject) |
|
210 | 210 | { |
211 | 211 | $aConfig = $aCallableOptions[$sClassName]; |
212 | 212 | $aCommonConfig = key_exists('*', $aConfig) ? $aConfig['*'] : []; |
213 | 213 | |
214 | 214 | $aProtectedMethods = is_subclass_of($sClassName, UserCallableClass::class) ? $aCallableMethods : []; |
215 | 215 | $aMethods = []; |
216 | - foreach($xCallableObject->getMethods() as $sMethodName) |
|
216 | + foreach ($xCallableObject->getMethods() as $sMethodName) |
|
217 | 217 | { |
218 | 218 | // Don't export methods of the CallableClass class |
219 | - if(in_array($sMethodName, $aProtectedMethods)) |
|
219 | + if (in_array($sMethodName, $aProtectedMethods)) |
|
220 | 220 | { |
221 | 221 | continue; |
222 | 222 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | public function canProcessRequest() |
248 | 248 | { |
249 | 249 | // Check the validity of the class name |
250 | - if(($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) || |
|
250 | + if (($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass)) || |
|
251 | 251 | ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))) |
252 | 252 | { |
253 | 253 | $this->sRequestedClass = null; |
@@ -263,14 +263,14 @@ discard block |
||
263 | 263 | */ |
264 | 264 | public function processRequest() |
265 | 265 | { |
266 | - if(!$this->canProcessRequest()) |
|
266 | + if (!$this->canProcessRequest()) |
|
267 | 267 | { |
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | |
271 | 271 | // Find the requested method |
272 | 272 | $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass); |
273 | - if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
273 | + if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod)) |
|
274 | 274 | { |
275 | 275 | // Unable to find the requested object or method |
276 | 276 | throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid', |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $di = jaxon()->di(); |
282 | 282 | $aArgs = $di->getRequestHandler()->processArguments(); |
283 | 283 | $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs); |
284 | - if(($xResponse)) |
|
284 | + if (($xResponse)) |
|
285 | 285 | { |
286 | 286 | $di->getResponseManager()->append($xResponse); |
287 | 287 | } |
@@ -191,8 +191,7 @@ discard block |
||
191 | 191 | if(($xCallback = $this->xCallbackManager->error())) |
192 | 192 | { |
193 | 193 | call_user_func_array($xCallback, [$xException]); |
194 | - } |
|
195 | - else |
|
194 | + } else |
|
196 | 195 | { |
197 | 196 | throw $xException; |
198 | 197 | } |
@@ -275,8 +274,7 @@ discard block |
||
275 | 274 | { |
276 | 275 | $this->xTargetRequestPlugin->processRequest(); |
277 | 276 | } |
278 | - } |
|
279 | - catch(Exception $e) |
|
277 | + } catch(Exception $e) |
|
280 | 278 | { |
281 | 279 | // An exception was thrown while processing the request. |
282 | 280 | // The request missed the corresponding handler function, |
@@ -287,8 +285,7 @@ discard block |
||
287 | 285 | if($e instanceof \Jaxon\Exception\Error) |
288 | 286 | { |
289 | 287 | $this->onInvalid($e->getMessage()); |
290 | - } |
|
291 | - else |
|
288 | + } else |
|
292 | 289 | { |
293 | 290 | $this->onError($e); |
294 | 291 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function onBefore(&$bEndRequest) |
145 | 145 | { |
146 | 146 | // Call the user defined callback |
147 | - if(($xCallback = $this->xCallbackManager->before())) |
|
147 | + if (($xCallback = $this->xCallbackManager->before())) |
|
148 | 148 | { |
149 | 149 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), &$bEndRequest]); |
150 | 150 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | */ |
158 | 158 | public function onAfter($bEndRequest) |
159 | 159 | { |
160 | - if(($xCallback = $this->xCallbackManager->after())) |
|
160 | + if (($xCallback = $this->xCallbackManager->after())) |
|
161 | 161 | { |
162 | 162 | call_user_func_array($xCallback, [$this->xTargetRequestPlugin->getTarget(), $bEndRequest]); |
163 | 163 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function onInvalid($sMessage) |
172 | 172 | { |
173 | - if(($xCallback = $this->xCallbackManager->invalid())) |
|
173 | + if (($xCallback = $this->xCallbackManager->invalid())) |
|
174 | 174 | { |
175 | 175 | call_user_func_array($xCallback, [$sMessage]); |
176 | 176 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function onError(Exception $xException) |
185 | 185 | { |
186 | - if(($xCallback = $this->xCallbackManager->error())) |
|
186 | + if (($xCallback = $this->xCallbackManager->error())) |
|
187 | 187 | { |
188 | 188 | call_user_func_array($xCallback, [$xException]); |
189 | 189 | } |
@@ -203,15 +203,15 @@ discard block |
||
203 | 203 | public function canProcessRequest() |
204 | 204 | { |
205 | 205 | // Return true if the request plugin was already found |
206 | - if(($this->xTargetRequestPlugin)) |
|
206 | + if (($this->xTargetRequestPlugin)) |
|
207 | 207 | { |
208 | 208 | return true; |
209 | 209 | } |
210 | 210 | |
211 | 211 | // Find a plugin to process the request |
212 | - foreach($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
212 | + foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin) |
|
213 | 213 | { |
214 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
214 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
215 | 215 | { |
216 | 216 | $this->xTargetRequestPlugin = $xPlugin; |
217 | 217 | return true; |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | public function processRequest() |
236 | 236 | { |
237 | 237 | // Check to see if headers have already been sent out, in which case we can't do our job |
238 | - if(headers_sent($filename, $linenumber)) |
|
238 | + if (headers_sent($filename, $linenumber)) |
|
239 | 239 | { |
240 | 240 | echo $this->trans('errors.output.already-sent', [ |
241 | 241 | 'location' => $filename . ':' . $linenumber |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | // Check if there is a plugin to process this request |
247 | - if(!$this->canProcessRequest()) |
|
247 | + if (!$this->canProcessRequest()) |
|
248 | 248 | { |
249 | 249 | return; |
250 | 250 | } |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | $bEndRequest = false; |
253 | 253 | |
254 | 254 | // Handle before processing event |
255 | - if(($this->xTargetRequestPlugin)) |
|
255 | + if (($this->xTargetRequestPlugin)) |
|
256 | 256 | { |
257 | 257 | $this->onBefore($bEndRequest); |
258 | 258 | } |
259 | 259 | |
260 | - if(!$bEndRequest) |
|
260 | + if (!$bEndRequest) |
|
261 | 261 | { |
262 | 262 | try |
263 | 263 | { |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | $this->xUploadRequestPlugin->processRequest(); |
266 | 266 | |
267 | 267 | // Process the request |
268 | - if(($this->xTargetRequestPlugin)) |
|
268 | + if (($this->xTargetRequestPlugin)) |
|
269 | 269 | { |
270 | 270 | $this->xTargetRequestPlugin->processRequest(); |
271 | 271 | } |
272 | 272 | } |
273 | - catch(Exception $e) |
|
273 | + catch (Exception $e) |
|
274 | 274 | { |
275 | 275 | // An exception was thrown while processing the request. |
276 | 276 | // The request missed the corresponding handler function, |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $this->xResponseManager->error($e->getMessage()); |
280 | 280 | |
281 | - if($e instanceof \Jaxon\Exception\Error) |
|
281 | + if ($e instanceof \Jaxon\Exception\Error) |
|
282 | 282 | { |
283 | 283 | $this->onInvalid($e->getMessage()); |
284 | 284 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | // Clean the processing buffer |
293 | - if(($this->getOption('core.process.clean'))) |
|
293 | + if (($this->getOption('core.process.clean'))) |
|
294 | 294 | { |
295 | 295 | $er = error_reporting(0); |
296 | 296 | while (ob_get_level() > 0) |
@@ -300,25 +300,25 @@ discard block |
||
300 | 300 | error_reporting($er); |
301 | 301 | } |
302 | 302 | |
303 | - if(($this->xTargetRequestPlugin)) |
|
303 | + if (($this->xTargetRequestPlugin)) |
|
304 | 304 | { |
305 | 305 | // Handle after processing event |
306 | 306 | $this->onAfter($bEndRequest); |
307 | 307 | } |
308 | 308 | |
309 | 309 | // If the called function returned no response, take the the global response |
310 | - if(!$this->xResponseManager->getResponse()) |
|
310 | + if (!$this->xResponseManager->getResponse()) |
|
311 | 311 | { |
312 | 312 | $this->xResponseManager->append(jaxon()->getResponse()); |
313 | 313 | } |
314 | 314 | |
315 | 315 | $this->xResponseManager->printDebug(); |
316 | 316 | |
317 | - if(($this->getOption('core.response.send'))) |
|
317 | + if (($this->getOption('core.response.send'))) |
|
318 | 318 | { |
319 | 319 | $this->xResponseManager->sendOutput(); |
320 | 320 | |
321 | - if(($this->getOption('core.process.exit'))) |
|
321 | + if (($this->getOption('core.process.exit'))) |
|
322 | 322 | { |
323 | 323 | exit(); |
324 | 324 | } |
@@ -100,11 +100,11 @@ |
||
100 | 100 | return new Target(self::TYPE_CLASS, '', $sClassName, $sMethodName); |
101 | 101 | } |
102 | 102 | |
103 | - /** |
|
104 | - * Check if the target type is Function. |
|
105 | - * |
|
106 | - * @return bool |
|
107 | - */ |
|
103 | + /** |
|
104 | + * Check if the target type is Function. |
|
105 | + * |
|
106 | + * @return bool |
|
107 | + */ |
|
108 | 108 | public function isFunction() |
109 | 109 | { |
110 | 110 | return $this->sType == self::TYPE_FUNCTION; |
@@ -60,7 +60,7 @@ |
||
60 | 60 | { |
61 | 61 | $this->sDirectory = ''; |
62 | 62 | $this->sExtension = ''; |
63 | - if(key_exists($sNamespace, $this->aDirectories)) |
|
63 | + if (key_exists($sNamespace, $this->aDirectories)) |
|
64 | 64 | { |
65 | 65 | // Make sure there's only one '/' at the end of the string |
66 | 66 | $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function addNamespace($sNamespace, $sDirectory, $sExtension = '') |
56 | 56 | { |
57 | 57 | // The 'jaxon' key cannot be overriden |
58 | - if($sNamespace == 'jaxon') |
|
58 | + if ($sNamespace == 'jaxon') |
|
59 | 59 | { |
60 | 60 | return; |
61 | 61 | } |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | // Get the namespace name |
93 | 93 | $sNamespace = ''; |
94 | 94 | $iSeparatorPosition = strrpos($sTemplate, '::'); |
95 | - if($iSeparatorPosition !== false) |
|
95 | + if ($iSeparatorPosition !== false) |
|
96 | 96 | { |
97 | 97 | $sNamespace = substr($sTemplate, 0, $iSeparatorPosition); |
98 | 98 | $sTemplate = substr($sTemplate, $iSeparatorPosition + 2); |
99 | 99 | } |
100 | 100 | // The default namespace is 'jaxon' |
101 | - if(!($sNamespace = trim($sNamespace))) |
|
101 | + if (!($sNamespace = trim($sNamespace))) |
|
102 | 102 | { |
103 | 103 | $sNamespace = 'jaxon'; |
104 | 104 | } |
105 | 105 | // Check if the namespace is defined |
106 | - if(!key_exists($sNamespace, $this->aNamespaces)) |
|
106 | + if (!key_exists($sNamespace, $this->aNamespaces)) |
|
107 | 107 | { |
108 | 108 | return ''; |
109 | 109 | } |
@@ -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 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public static function getInstance() |
84 | 84 | { |
85 | - if(self::$xInstance == null) |
|
85 | + if (self::$xInstance == null) |
|
86 | 86 | { |
87 | 87 | self::$xInstance = new Jaxon(); |
88 | 88 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function __construct() |
96 | 96 | { |
97 | - if(self::$xContainer == null) |
|
97 | + if (self::$xContainer == null) |
|
98 | 98 | { |
99 | 99 | self::$xContainer = new Container(); |
100 | 100 | $this->setDefaultOptions(); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'core.prefix.class' => 'Jaxon', |
155 | 155 | // 'core.request.uri' => '', |
156 | 156 | 'core.request.mode' => 'asynchronous', |
157 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
157 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
158 | 158 | 'core.response.send' => true, |
159 | 159 | 'core.response.merge.ap' => true, |
160 | 160 | 'core.response.merge.js' => true, |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function register($sType, $sCallable, $xOptions = []) |
242 | 242 | { |
243 | - if($sType == Jaxon::PROCESSING_EVENT) |
|
243 | + if ($sType == Jaxon::PROCESSING_EVENT) |
|
244 | 244 | { |
245 | 245 | $sEvent = $sCallable; |
246 | 246 | $xCallback = $xOptions; |
247 | - switch($sEvent) |
|
247 | + switch ($sEvent) |
|
248 | 248 | { |
249 | 249 | case Jaxon::PROCESSING_EVENT_BEFORE: |
250 | 250 | $this->callback()->before($xCallback); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function sendHeaders() |
33 | 33 | { |
34 | - if($this->getRequesthandler()->requestMethodIsGet()) |
|
34 | + if ($this->getRequesthandler()->requestMethodIsGet()) |
|
35 | 35 | { |
36 | 36 | header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); |
37 | 37 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $sCharacterSet = ''; |
43 | 43 | $sCharacterEncoding = $this->getCharacterEncoding(); |
44 | - if(is_string($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
44 | + if (is_string($sCharacterEncoding) && strlen($sCharacterEncoding) > 0) |
|
45 | 45 | { |
46 | 46 | $sCharacterSet = '; charset="' . $sCharacterEncoding . '"'; |
47 | 47 | } |