@@ -27,7 +27,7 @@ |
||
27 | 27 | public function render($sPath, array $aVars = []) |
28 | 28 | { |
29 | 29 | // Make the template vars available as attributes |
30 | - foreach($aVars as $sName => $xValue) |
|
30 | + foreach ($aVars as $sName => $xValue) |
|
31 | 31 | { |
32 | 32 | $sName = (string)$sName; |
33 | 33 | $this->$sName = $xValue; |
@@ -50,14 +50,14 @@ discard block |
||
50 | 50 | $sPrefix = trim((string)$sPrefix); |
51 | 51 | $nDepth = intval($nDepth); |
52 | 52 | // Check the max depth |
53 | - if($nDepth < 0 || $nDepth > 9) |
|
53 | + if ($nDepth < 0 || $nDepth > 9) |
|
54 | 54 | { |
55 | 55 | throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.depth', |
56 | 56 | array('key' => $sPrefix, 'depth' => $nDepth))); |
57 | 57 | } |
58 | - foreach($aOptions as $sName => $xOption) |
|
58 | + foreach ($aOptions as $sName => $xOption) |
|
59 | 59 | { |
60 | - if(is_int($sName)) |
|
60 | + if (is_int($sName)) |
|
61 | 61 | { |
62 | 62 | continue; |
63 | 63 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | // Save the value of this option |
68 | 68 | $this->aOptions[$sFullName] = $xOption; |
69 | 69 | // Save the values of its sub-options |
70 | - if(is_array($xOption)) |
|
70 | + if (is_array($xOption)) |
|
71 | 71 | { |
72 | 72 | // Recursively read the options in the array |
73 | 73 | $this->_setOptions($xOption, $sFullName, $nDepth + 1); |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | $aKeys = explode('.', (string)$sKeys); |
90 | 90 | foreach ($aKeys as $sKey) |
91 | 91 | { |
92 | - if(($sKey)) |
|
92 | + if (($sKey)) |
|
93 | 93 | { |
94 | - if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
94 | + if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey])) |
|
95 | 95 | { |
96 | 96 | return; |
97 | 97 | } |
@@ -139,13 +139,12 @@ discard block |
||
139 | 139 | $sPrefix = rtrim($sPrefix, '.') . '.'; |
140 | 140 | $sPrefixLen = strlen($sPrefix); |
141 | 141 | $aOptions = []; |
142 | - foreach($this->aOptions as $sName => $xValue) |
|
142 | + foreach ($this->aOptions as $sName => $xValue) |
|
143 | 143 | { |
144 | - if(substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
144 | + if (substr($sName, 0, $sPrefixLen) == $sPrefix) |
|
145 | 145 | { |
146 | 146 | $iNextDotPos = strpos($sName, '.', $sPrefixLen); |
147 | - $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : |
|
148 | - substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
147 | + $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen); |
|
149 | 148 | $aOptions[$sOptionName] = $sPrefix . $sOptionName; |
150 | 149 | } |
151 | 150 | } |
@@ -223,13 +223,11 @@ discard block |
||
223 | 223 | { |
224 | 224 | // The name of a request plugin is used as key in the plugin table |
225 | 225 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
226 | - } |
|
227 | - elseif($xPlugin instanceof Response) |
|
226 | + } elseif($xPlugin instanceof Response) |
|
228 | 227 | { |
229 | 228 | // The name of a response plugin is used as key in the plugin table |
230 | 229 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
231 | - } |
|
232 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
230 | + } elseif(!$bIsConfirm && !$bIsAlert) |
|
233 | 231 | { |
234 | 232 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
235 | 233 | } |
@@ -644,8 +642,7 @@ discard block |
||
644 | 642 | 'sJsOptions' => $this->getOption('js.app.options'), |
645 | 643 | 'sUrl' => $sJsAppURI . $sOutFile, |
646 | 644 | )); |
647 | - } |
|
648 | - else |
|
645 | + } else |
|
649 | 646 | { |
650 | 647 | // The plugins scripts are wrapped with javascript tags |
651 | 648 | $sScript = $this->render('jaxon::plugins/wrapper.js', array( |
@@ -219,32 +219,32 @@ discard block |
||
219 | 219 | { |
220 | 220 | $bIsAlert = ($xPlugin instanceof Dialogs\Interfaces\Alert); |
221 | 221 | $bIsConfirm = ($xPlugin instanceof Dialogs\Interfaces\Confirm); |
222 | - if($xPlugin instanceof Request) |
|
222 | + if ($xPlugin instanceof Request) |
|
223 | 223 | { |
224 | 224 | // The name of a request plugin is used as key in the plugin table |
225 | 225 | $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin; |
226 | 226 | } |
227 | - elseif($xPlugin instanceof Response) |
|
227 | + elseif ($xPlugin instanceof Response) |
|
228 | 228 | { |
229 | 229 | // The name of a response plugin is used as key in the plugin table |
230 | 230 | $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin; |
231 | 231 | } |
232 | - elseif(!$bIsConfirm && !$bIsAlert) |
|
232 | + elseif (!$bIsConfirm && !$bIsAlert) |
|
233 | 233 | { |
234 | 234 | throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin)))); |
235 | 235 | } |
236 | 236 | // This plugin implements the Alert interface |
237 | - if($bIsAlert) |
|
237 | + if ($bIsAlert) |
|
238 | 238 | { |
239 | 239 | $this->setAlert($xPlugin); |
240 | 240 | } |
241 | 241 | // This plugin implements the Confirm interface |
242 | - if($bIsConfirm) |
|
242 | + if ($bIsConfirm) |
|
243 | 243 | { |
244 | 244 | $this->setConfirm($xPlugin); |
245 | 245 | } |
246 | 246 | // Register the plugin as an event listener |
247 | - if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
247 | + if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener) |
|
248 | 248 | { |
249 | 249 | $this->addEventListener($xPlugin); |
250 | 250 | } |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | private function generateHash() |
275 | 275 | { |
276 | 276 | $sHash = $this->getVersion(); |
277 | - foreach($this->aPlugins as $xPlugin) |
|
277 | + foreach ($this->aPlugins as $xPlugin) |
|
278 | 278 | { |
279 | 279 | $sHash .= $xPlugin->generateHash(); |
280 | 280 | } |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | */ |
292 | 292 | public function canProcessRequest() |
293 | 293 | { |
294 | - foreach($this->aRequestPlugins as $xPlugin) |
|
294 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
295 | 295 | { |
296 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
296 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
297 | 297 | { |
298 | 298 | return true; |
299 | 299 | } |
@@ -312,12 +312,12 @@ discard block |
||
312 | 312 | public function processRequest() |
313 | 313 | { |
314 | 314 | $xUploadPlugin = $this->getRequestPlugin(Jaxon::FILE_UPLOAD); |
315 | - foreach($this->aRequestPlugins as $xPlugin) |
|
315 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
316 | 316 | { |
317 | - if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
317 | + if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest()) |
|
318 | 318 | { |
319 | 319 | // Process uploaded files |
320 | - if($xUploadPlugin != null) |
|
320 | + if ($xUploadPlugin != null) |
|
321 | 321 | { |
322 | 322 | $xUploadPlugin->processRequest(); |
323 | 323 | } |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function register($sType, $sCallable, $aOptions) |
344 | 344 | { |
345 | - if(!key_exists($sType, $this->aRequestPlugins)) |
|
345 | + if (!key_exists($sType, $this->aRequestPlugins)) |
|
346 | 346 | { |
347 | 347 | throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType])); |
348 | 348 | } |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | */ |
367 | 367 | private function getJsLibUri() |
368 | 368 | { |
369 | - if(!$this->hasOption('js.lib.uri')) |
|
369 | + if (!$this->hasOption('js.lib.uri')) |
|
370 | 370 | { |
371 | 371 | // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/'; |
372 | 372 | return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/'; |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | // The jsDelivr CDN only hosts minified files |
390 | 390 | // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri) |
391 | 391 | // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files. |
392 | - if(($this->getOption('js.app.minify'))) |
|
392 | + if (($this->getOption('js.app.minify'))) |
|
393 | 393 | { |
394 | 394 | return '.min.js'; |
395 | 395 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // Check config options |
407 | 407 | // - The js.app.extern option must be set to true |
408 | 408 | // - The js.app.uri and js.app.dir options must be set to non null values |
409 | - if(!$this->getOption('js.app.extern') || |
|
409 | + if (!$this->getOption('js.app.extern') || |
|
410 | 410 | !$this->getOption('js.app.uri') || |
411 | 411 | !$this->getOption('js.app.dir')) |
412 | 412 | { |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | // Check dir access |
416 | 416 | // - The js.app.dir must be writable |
417 | 417 | $sJsAppDir = $this->getOption('js.app.dir'); |
418 | - if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
418 | + if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir)) |
|
419 | 419 | { |
420 | 420 | return false; |
421 | 421 | } |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | private function setTemplateCacheDir() |
431 | 431 | { |
432 | - if($this->hasOption('core.template.cache_dir')) |
|
432 | + if ($this->hasOption('core.template.cache_dir')) |
|
433 | 433 | { |
434 | 434 | $this->setCacheDir($this->getOption('core.template.cache_dir')); |
435 | 435 | } |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | // Add component files to the javascript file array; |
453 | 453 | $aJsFiles = array($sJsCoreUrl); |
454 | - if($this->getOption('core.debug.on')) |
|
454 | + if ($this->getOption('core.debug.on')) |
|
455 | 455 | { |
456 | 456 | $aJsFiles[] = $sJsDebugUrl; |
457 | 457 | $aJsFiles[] = $sJsLanguageUrl; |
@@ -467,17 +467,17 @@ discard block |
||
467 | 467 | 'sJsOptions' => $this->getOption('js.app.options'), |
468 | 468 | 'aUrls' => $aJsFiles, |
469 | 469 | )); |
470 | - foreach($this->aResponsePlugins as $xPlugin) |
|
470 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
471 | 471 | { |
472 | - if(($str = trim($xPlugin->getJs()))) |
|
472 | + if (($str = trim($xPlugin->getJs()))) |
|
473 | 473 | { |
474 | 474 | $sCode .= rtrim($str, " \n") . "\n"; |
475 | 475 | } |
476 | 476 | } |
477 | - foreach($this->aPackages as $sClass) |
|
477 | + foreach ($this->aPackages as $sClass) |
|
478 | 478 | { |
479 | 479 | $xPackage = jaxon()->di()->get($sClass); |
480 | - if(($str = trim($xPackage->js()))) |
|
480 | + if (($str = trim($xPackage->js()))) |
|
481 | 481 | { |
482 | 482 | $sCode .= rtrim($str, " \n") . "\n"; |
483 | 483 | } |
@@ -496,17 +496,17 @@ discard block |
||
496 | 496 | $this->setTemplateCacheDir(); |
497 | 497 | |
498 | 498 | $sCode = ''; |
499 | - foreach($this->aResponsePlugins as $xPlugin) |
|
499 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
500 | 500 | { |
501 | - if(($str = trim($xPlugin->getCss()))) |
|
501 | + if (($str = trim($xPlugin->getCss()))) |
|
502 | 502 | { |
503 | 503 | $sCode .= rtrim($str, " \n") . "\n"; |
504 | 504 | } |
505 | 505 | } |
506 | - foreach($this->aPackages as $sClass) |
|
506 | + foreach ($this->aPackages as $sClass) |
|
507 | 507 | { |
508 | 508 | $xPackage = jaxon()->di()->get($sClass); |
509 | - if(($str = trim($xPackage->css()))) |
|
509 | + if (($str = trim($xPackage->css()))) |
|
510 | 510 | { |
511 | 511 | $sCode .= rtrim($str, " \n") . "\n"; |
512 | 512 | } |
@@ -570,17 +570,17 @@ discard block |
||
570 | 570 | private function getReadyScript() |
571 | 571 | { |
572 | 572 | $sPluginScript = ''; |
573 | - foreach($this->aResponsePlugins as $xPlugin) |
|
573 | + foreach ($this->aResponsePlugins as $xPlugin) |
|
574 | 574 | { |
575 | - if(($str = trim($xPlugin->getScript()))) |
|
575 | + if (($str = trim($xPlugin->getScript()))) |
|
576 | 576 | { |
577 | 577 | $sPluginScript .= "\n" . trim($str, " \n"); |
578 | 578 | } |
579 | 579 | } |
580 | - foreach($this->aPackages as $sClass) |
|
580 | + foreach ($this->aPackages as $sClass) |
|
581 | 581 | { |
582 | 582 | $xPackage = jaxon()->di()->get($sClass); |
583 | - if(($str = trim($xPackage->ready()))) |
|
583 | + if (($str = trim($xPackage->ready()))) |
|
584 | 584 | { |
585 | 585 | $sPluginScript .= "\n" . trim($str, " \n"); |
586 | 586 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | { |
604 | 604 | // Get the config and plugins scripts |
605 | 605 | $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n"; |
606 | - foreach($this->aRequestPlugins as $xPlugin) |
|
606 | + foreach ($this->aRequestPlugins as $xPlugin) |
|
607 | 607 | { |
608 | 608 | $sScript .= "\n" . trim($xPlugin->getScript(), " \n"); |
609 | 609 | } |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | // Set the template engine cache dir |
626 | 626 | $this->setTemplateCacheDir(); |
627 | 627 | |
628 | - if($this->canExportJavascript()) |
|
628 | + if ($this->canExportJavascript()) |
|
629 | 629 | { |
630 | 630 | $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/'; |
631 | 631 | $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/'; |
@@ -634,13 +634,13 @@ discard block |
||
634 | 634 | $sHash = $this->generateHash(); |
635 | 635 | $sOutFile = $sHash . '.js'; |
636 | 636 | $sMinFile = $sHash . '.min.js'; |
637 | - if(!is_file($sJsAppDir . $sOutFile)) |
|
637 | + if (!is_file($sJsAppDir . $sOutFile)) |
|
638 | 638 | { |
639 | 639 | file_put_contents($sJsAppDir . $sOutFile, $this->getAllScripts()); |
640 | 640 | } |
641 | - if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
641 | + if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile)) |
|
642 | 642 | { |
643 | - if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
643 | + if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile))) |
|
644 | 644 | { |
645 | 645 | $sOutFile = $sMinFile; |
646 | 646 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | */ |
674 | 674 | public function getResponsePlugin($sName) |
675 | 675 | { |
676 | - if(array_key_exists($sName, $this->aResponsePlugins)) |
|
676 | + if (array_key_exists($sName, $this->aResponsePlugins)) |
|
677 | 677 | { |
678 | 678 | return $this->aResponsePlugins[$sName]; |
679 | 679 | } |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | */ |
690 | 690 | public function getRequestPlugin($sName) |
691 | 691 | { |
692 | - if(array_key_exists($sName, $this->aRequestPlugins)) |
|
692 | + if (array_key_exists($sName, $this->aRequestPlugins)) |
|
693 | 693 | { |
694 | 694 | return $this->aRequestPlugins[$sName]; |
695 | 695 | } |
@@ -62,6 +62,9 @@ discard block |
||
62 | 62 | */ |
63 | 63 | private $aConfiguration; |
64 | 64 | |
65 | + /** |
|
66 | + * @param string $sUserFunction |
|
67 | + */ |
|
65 | 68 | public function __construct($sUserFunction) |
66 | 69 | { |
67 | 70 | $this->aConfiguration = []; |
@@ -114,7 +117,7 @@ discard block |
||
114 | 117 | /** |
115 | 118 | * Constructs and returns a <Jaxon\Request\Request> object which is capable of generating the javascript call to invoke this jaxon enabled function |
116 | 119 | * |
117 | - * @return Jaxon\Request\Request |
|
120 | + * @return Request |
|
118 | 121 | */ |
119 | 122 | public function generateRequest() |
120 | 123 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | public function getName() |
78 | 78 | { |
79 | 79 | // Do not use sAlias here! |
80 | - if(is_array($this->sUserFunction)) |
|
80 | + if (is_array($this->sUserFunction)) |
|
81 | 81 | { |
82 | 82 | return $this->sUserFunction[1]; |
83 | 83 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function configure($sName, $sValue) |
96 | 96 | { |
97 | - switch($sName) |
|
97 | + switch ($sName) |
|
98 | 98 | { |
99 | 99 | case 'class': // The user function is a method in the given class |
100 | 100 | $this->sUserFunction = [new $sValue, $this->sUserFunction]; |
@@ -151,12 +151,12 @@ discard block |
||
151 | 151 | */ |
152 | 152 | public function call($aArgs = []) |
153 | 153 | { |
154 | - if(($this->sInclude)) |
|
154 | + if (($this->sInclude)) |
|
155 | 155 | { |
156 | 156 | require_once $this->sInclude; |
157 | 157 | } |
158 | 158 | $response = call_user_func_array($this->sUserFunction, $aArgs); |
159 | - if(($response)) |
|
159 | + if (($response)) |
|
160 | 160 | { |
161 | 161 | $this->getResponseManager()->append($response); |
162 | 162 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | */ |
23 | 23 | public function confirm($question, $yesScript, $noScript) |
24 | 24 | { |
25 | - if(!$noScript) |
|
25 | + if (!$noScript) |
|
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | 28 | } |
@@ -25,8 +25,7 @@ |
||
25 | 25 | if(!$noScript) |
26 | 26 | { |
27 | 27 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}'; |
28 | - } |
|
29 | - else |
|
28 | + } else |
|
30 | 29 | { |
31 | 30 | return 'if(confirm(' . $question . ')){' . $yesScript . ';}else{' . $noScript . ';}'; |
32 | 31 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | */ |
27 | 27 | protected function alert($message, $title) |
28 | 28 | { |
29 | - if($this->getReturn()) |
|
29 | + if ($this->getReturn()) |
|
30 | 30 | { |
31 | 31 | return 'alert(' . $message . ')'; |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param string|null $sClass The callable class |
37 | 37 | * |
38 | - * @return Factory |
|
38 | + * @return Request |
|
39 | 39 | */ |
40 | 40 | public function setClassName($sClass) |
41 | 41 | { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param CallableObject $xCallable The callable object |
60 | 60 | * |
61 | - * @return Factory |
|
61 | + * @return Request |
|
62 | 62 | */ |
63 | 63 | public function setCallable(CallableObject $xCallable) |
64 | 64 | { |
@@ -71,7 +71,6 @@ discard block |
||
71 | 71 | * Return the javascript call to a Jaxon function or object method |
72 | 72 | * |
73 | 73 | * @param string $sFunction The function or method (without class) name |
74 | - * @param ... $xParams The parameters of the function or method |
|
75 | 74 | * |
76 | 75 | * @return \Jaxon\Request\Request |
77 | 76 | */ |
@@ -100,7 +99,6 @@ discard block |
||
100 | 99 | * Return the javascript call to a generic function |
101 | 100 | * |
102 | 101 | * @param string $sFunction The function or method (with class) name |
103 | - * @param ... $xParams The parameters of the function or method |
|
104 | 102 | * |
105 | 103 | * @return \Jaxon\Request\Request |
106 | 104 | */ |
@@ -124,7 +122,6 @@ discard block |
||
124 | 122 | * @param integer $nItemsPerPage The number of items per page page |
125 | 123 | * @param integer $nCurrentPage The current page |
126 | 124 | * @param string $sMethod The name of function or a method prepended with its class name |
127 | - * @param ... $xParams The parameters of the function or method |
|
128 | 125 | * |
129 | 126 | * @return string the pagination links |
130 | 127 | */ |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | $this->sPrefix = $this->getOption('core.prefix.function'); |
68 | 68 | |
69 | 69 | $sClass = trim($sClass, '.\\ '); |
70 | - if(!$sClass) |
|
70 | + if (!$sClass) |
|
71 | 71 | { |
72 | 72 | return $this; |
73 | 73 | } |
74 | 74 | |
75 | 75 | $xCallable = $this->xCallableClassPlugin->getCallableObject($sClass); |
76 | - if(!$xCallable) |
|
76 | + if (!$xCallable) |
|
77 | 77 | { |
78 | 78 | $xCallable = $this->xCallableDirPlugin->getCallableObject($sClass); |
79 | 79 | } |
80 | - if(!$xCallable) |
|
80 | + if (!$xCallable) |
|
81 | 81 | { |
82 | 82 | // Todo: decide which of these values to return |
83 | 83 | // return null; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | array_shift($aArguments); |
119 | 119 | |
120 | 120 | // Makes legacy code works |
121 | - if(strpos($sFunction, '.') !== false) |
|
121 | + if (strpos($sFunction, '.') !== false) |
|
122 | 122 | { |
123 | 123 | // If there is a dot in the name, then it is a call to a class |
124 | 124 | $this->sPrefix = $this->getOption('core.prefix.class'); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | public static function getInstance() |
32 | 32 | { |
33 | - if(!self::$xInstance) |
|
33 | + if (!self::$xInstance) |
|
34 | 34 | { |
35 | 35 | self::$xInstance = new Container(); |
36 | 36 | } |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | * Managers |
91 | 91 | */ |
92 | 92 | // Plugin Manager |
93 | - $this->coreContainer['jaxon.core.plugin_manager'] = function ($c) { |
|
93 | + $this->coreContainer['jaxon.core.plugin_manager'] = function($c) { |
|
94 | 94 | return new \Jaxon\Plugin\Manager(); |
95 | 95 | }; |
96 | 96 | // Request Manager |
97 | - $this->coreContainer['jaxon.core.request_manager'] = function ($c) { |
|
97 | + $this->coreContainer['jaxon.core.request_manager'] = function($c) { |
|
98 | 98 | return new \Jaxon\Request\Manager(); |
99 | 99 | }; |
100 | 100 | // Request Factory |
101 | - $this->coreContainer['jaxon.core.request_factory'] = function ($c) { |
|
101 | + $this->coreContainer['jaxon.core.request_factory'] = function($c) { |
|
102 | 102 | return new \Jaxon\Factory\Request(); |
103 | 103 | }; |
104 | 104 | // Parameter Factory |
105 | - $this->coreContainer['jaxon.core.parameter_factory'] = function ($c) { |
|
105 | + $this->coreContainer['jaxon.core.parameter_factory'] = function($c) { |
|
106 | 106 | return new \Jaxon\Factory\Parameter(); |
107 | 107 | }; |
108 | 108 | // Response Manager |
109 | - $this->coreContainer['jaxon.core.response_manager'] = function ($c) { |
|
109 | + $this->coreContainer['jaxon.core.response_manager'] = function($c) { |
|
110 | 110 | return new \Jaxon\Response\Manager(); |
111 | 111 | }; |
112 | 112 | |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | * Services |
115 | 115 | */ |
116 | 116 | // Config manager |
117 | - $this->coreContainer['jaxon.core.config'] = function ($c) { |
|
117 | + $this->coreContainer['jaxon.core.config'] = function($c) { |
|
118 | 118 | return new \Jaxon\Utils\Config\Config(); |
119 | 119 | }; |
120 | 120 | // Minifier |
121 | - $this->coreContainer['jaxon.core.minifier'] = function ($c) { |
|
121 | + $this->coreContainer['jaxon.core.minifier'] = function($c) { |
|
122 | 122 | return new \Jaxon\Utils\Template\Minifier(); |
123 | 123 | }; |
124 | 124 | // Translator |
125 | - $this->coreContainer['jaxon.core.translator'] = function ($c) { |
|
125 | + $this->coreContainer['jaxon.core.translator'] = function($c) { |
|
126 | 126 | return new \Jaxon\Utils\Translation\Translator($c['jaxon.core.translation_dir'], $c['jaxon.core.config']); |
127 | 127 | }; |
128 | 128 | // Template engine |
129 | - $this->coreContainer['jaxon.core.template'] = function ($c) { |
|
129 | + $this->coreContainer['jaxon.core.template'] = function($c) { |
|
130 | 130 | return new \Jaxon\Utils\Template\Template($c['jaxon.core.template_dir']); |
131 | 131 | }; |
132 | 132 | // Validator |
133 | - $this->coreContainer['jaxon.core.validator'] = function ($c) { |
|
133 | + $this->coreContainer['jaxon.core.validator'] = function($c) { |
|
134 | 134 | return new \Jaxon\Utils\Validation\Validator($c['jaxon.core.translator'], $c['jaxon.core.config']); |
135 | 135 | }; |
136 | 136 | // Pagination Renderer |
137 | - $this->coreContainer['jaxon.pagination.renderer'] = function ($c) { |
|
137 | + $this->coreContainer['jaxon.pagination.renderer'] = function($c) { |
|
138 | 138 | return new \Jaxon\Utils\Pagination\Renderer(); |
139 | 139 | }; |
140 | 140 | // Pagination Paginator |
141 | - $this->coreContainer['jaxon.pagination.paginator'] = function ($c) { |
|
141 | + $this->coreContainer['jaxon.pagination.paginator'] = function($c) { |
|
142 | 142 | return new \Jaxon\Utils\Pagination\Paginator($c['jaxon.pagination.renderer']); |
143 | 143 | }; |
144 | 144 | // Event Dispatcher |
145 | - $this->coreContainer['jaxon.core.events'] = function ($c) { |
|
145 | + $this->coreContainer['jaxon.core.events'] = function($c) { |
|
146 | 146 | return new EventDispatcher(); |
147 | 147 | }; |
148 | 148 | |
@@ -150,15 +150,15 @@ discard block |
||
150 | 150 | * Core library objects |
151 | 151 | */ |
152 | 152 | // Global Response |
153 | - $this->coreContainer['jaxon.core.response'] = function ($c) { |
|
153 | + $this->coreContainer['jaxon.core.response'] = function($c) { |
|
154 | 154 | return new \Jaxon\Response\Response(); |
155 | 155 | }; |
156 | 156 | // Jaxon Core |
157 | - $this->coreContainer['jaxon.core.jaxon'] = function ($c) { |
|
157 | + $this->coreContainer['jaxon.core.jaxon'] = function($c) { |
|
158 | 158 | return new \Jaxon\Jaxon(); |
159 | 159 | }; |
160 | 160 | // View Renderer Facade |
161 | - $this->coreContainer['jaxon.sentry.view.renderer'] = function ($c) { |
|
161 | + $this->coreContainer['jaxon.sentry.view.renderer'] = function($c) { |
|
162 | 162 | $aRenderers = $c['jaxon.view.data.renderers']; |
163 | 163 | $sDefaultNamespace = $c['jaxon.view.data.namespace.default']; |
164 | 164 | return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | */ |
173 | 173 | public function get($sClass) |
174 | 174 | { |
175 | - if($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
175 | + if ($this->sentryContainer != null && $this->sentryContainer->has($sClass)) |
|
176 | 176 | { |
177 | 177 | return $this->sentryContainer->get($sClass); |
178 | 178 | } |
@@ -457,14 +457,14 @@ discard block |
||
457 | 457 | $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure; |
458 | 458 | |
459 | 459 | // Return the initialized view renderer |
460 | - $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) { |
|
460 | + $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) { |
|
461 | 461 | // Get the defined renderer |
462 | 462 | $renderer = $c['jaxon.sentry.view.base.' . $sId]; |
463 | 463 | // Init the renderer with the template namespaces |
464 | 464 | $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces']; |
465 | - if(key_exists($sId, $aNamespaces)) |
|
465 | + if (key_exists($sId, $aNamespaces)) |
|
466 | 466 | { |
467 | - foreach($aNamespaces[$sId] as $ns) |
|
467 | + foreach ($aNamespaces[$sId] as $ns) |
|
468 | 468 | { |
469 | 469 | $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']); |
470 | 470 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | */ |
483 | 483 | public function getViewRenderer($sId = '') |
484 | 484 | { |
485 | - if(!$sId) |
|
485 | + if (!$sId) |
|
486 | 486 | { |
487 | 487 | // Return the view renderer facade |
488 | 488 | return $this->coreContainer['jaxon.sentry.view.renderer']; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | /** |
256 | 256 | * Create a new the config manager |
257 | 257 | * |
258 | - * @return Jaxon\Utils\Config\Config The config manager |
|
258 | + * @return \Jaxon\Utils\Config\Config The config manager |
|
259 | 259 | */ |
260 | 260 | public function newConfig() |
261 | 261 | { |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * Create a new Jaxon response object |
349 | 349 | * |
350 | - * @return Jaxon\Response\Response |
|
350 | + * @return \Jaxon\Response\Response |
|
351 | 351 | */ |
352 | 352 | public function newResponse() |
353 | 353 | { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | 'core.prefix.class' => 'Jaxon', |
43 | 43 | // 'core.request.uri' => '', |
44 | 44 | 'core.request.mode' => 'asynchronous', |
45 | - 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
45 | + 'core.request.method' => 'POST', // W3C: Method is case sensitive |
|
46 | 46 | 'core.response.merge.ap' => true, |
47 | 47 | 'core.response.merge.js' => true, |
48 | 48 | 'core.debug.on' => false, |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null) |
119 | 119 | { |
120 | 120 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
121 | - switch($sExt) |
|
121 | + switch ($sExt) |
|
122 | 122 | { |
123 | 123 | case 'php': |
124 | 124 | return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey); |