Completed
Push — master ( fced39...909472 )
by Thierry
01:44
created
src/Plugin/Manager.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -24,8 +24,6 @@
 block discarded – undo
24 24
 use Jaxon\Jaxon;
25 25
 use RecursiveDirectoryIterator;
26 26
 use RecursiveIteratorIterator;
27
-use RegexIterator;
28
-use RecursiveRegexIterator;
29 27
 
30 28
 class Manager
31 29
 {
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -266,13 +266,11 @@  discard block
 block discarded – undo
266 266
         {
267 267
             // The name of a request plugin is used as key in the plugin table
268 268
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
269
-        }
270
-        elseif($xPlugin instanceof Response)
269
+        } elseif($xPlugin instanceof Response)
271 270
         {
272 271
             // The name of a response plugin is used as key in the plugin table
273 272
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
274
-        }
275
-        elseif(!$bIsConfirm && !$bIsAlert)
273
+        } elseif(!$bIsConfirm && !$bIsAlert)
276 274
         {
277 275
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin))));
278 276
         }
@@ -406,8 +404,7 @@  discard block
 block discarded – undo
406 404
             {
407 405
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
408 406
             }
409
-        }
410
-        elseif(($this->xAutoloader))
407
+        } elseif(($this->xAutoloader))
411 408
         {
412 409
             // If there is an autoloader, register the dir with classmap autoloading
413 410
             $itDir = new RecursiveDirectoryIterator($sDirectory);
@@ -582,8 +579,7 @@  discard block
 block discarded – undo
582 579
             if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace)
583 580
             {
584 581
                 $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1);
585
-            }
586
-            elseif(!($sNamespace))
582
+            } elseif(!($sNamespace))
587 583
             {
588 584
                 $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath;
589 585
             }
@@ -891,8 +887,7 @@  discard block
 block discarded – undo
891 887
                 'sJsOptions' => $this->getOption('js.app.options'),
892 888
                 'sUrl' => $sJsAppURI . $sOutFile,
893 889
             ));
894
-        }
895
-        else
890
+        } else
896 891
         {
897 892
             // The plugins scripts are wrapped with javascript tags
898 893
             $sScript = $this->render('jaxon::plugins/wrapper.js', array(
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -262,32 +262,32 @@  discard block
 block discarded – undo
262 262
     {
263 263
         $bIsAlert = ($xPlugin instanceof \Jaxon\Request\Interfaces\Alert);
264 264
         $bIsConfirm = ($xPlugin instanceof \Jaxon\Request\Interfaces\Confirm);
265
-        if($xPlugin instanceof Request)
265
+        if ($xPlugin instanceof Request)
266 266
         {
267 267
             // The name of a request plugin is used as key in the plugin table
268 268
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
269 269
         }
270
-        elseif($xPlugin instanceof Response)
270
+        elseif ($xPlugin instanceof Response)
271 271
         {
272 272
             // The name of a response plugin is used as key in the plugin table
273 273
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
274 274
         }
275
-        elseif(!$bIsConfirm && !$bIsAlert)
275
+        elseif (!$bIsConfirm && !$bIsAlert)
276 276
         {
277 277
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin))));
278 278
         }
279 279
         // This plugin implements the Alert interface
280
-        if($bIsAlert)
280
+        if ($bIsAlert)
281 281
         {
282 282
             $this->setAlert($xPlugin);
283 283
         }
284 284
         // This plugin implements the Confirm interface
285
-        if($bIsConfirm)
285
+        if ($bIsConfirm)
286 286
         {
287 287
             $this->setConfirm($xPlugin);
288 288
         }
289 289
         // Register the plugin as an event listener
290
-        if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
290
+        if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
291 291
         {
292 292
             $this->addEventListener($xPlugin);
293 293
         }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     private function generateHash()
304 304
     {
305 305
         $sHash = $this->getVersion();
306
-        foreach($this->aPlugins as $xPlugin)
306
+        foreach ($this->aPlugins as $xPlugin)
307 307
         {
308 308
             $sHash .= $xPlugin->generateHash();
309 309
         }
@@ -320,9 +320,9 @@  discard block
 block discarded – undo
320 320
      */
321 321
     public function canProcessRequest()
322 322
     {
323
-        foreach($this->aRequestPlugins as $xPlugin)
323
+        foreach ($this->aRequestPlugins as $xPlugin)
324 324
         {
325
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
325
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
326 326
             {
327 327
                 return true;
328 328
             }
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
     public function processRequest()
342 342
     {
343 343
         $xUploadPlugin = $this->getRequestPlugin(Jaxon::FILE_UPLOAD);
344
-        foreach($this->aRequestPlugins as $xPlugin)
344
+        foreach ($this->aRequestPlugins as $xPlugin)
345 345
         {
346
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
346
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
347 347
             {
348 348
                 // Process uploaded files
349
-                if($xUploadPlugin != null)
349
+                if ($xUploadPlugin != null)
350 350
                 {
351 351
                     $xUploadPlugin->processRequest();
352 352
                 }
@@ -370,10 +370,10 @@  discard block
 block discarded – undo
370 370
      */
371 371
     public function register($aArgs)
372 372
     {
373
-        foreach($this->aRequestPlugins as $xPlugin)
373
+        foreach ($this->aRequestPlugins as $xPlugin)
374 374
         {
375 375
             $mResult = $xPlugin->register($aArgs);
376
-            if($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true)
376
+            if ($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true)
377 377
             {
378 378
                 return $mResult;
379 379
             }
@@ -393,37 +393,37 @@  discard block
 block discarded – undo
393 393
      */
394 394
     public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = array())
395 395
     {
396
-        if(!is_dir(($sDirectory = trim($sDirectory))))
396
+        if (!is_dir(($sDirectory = trim($sDirectory))))
397 397
         {
398 398
             return false;
399 399
         }
400 400
         // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead.
401
-        if(($sSeparator = trim($sSeparator)) != '_')
401
+        if (($sSeparator = trim($sSeparator)) != '_')
402 402
         {
403 403
             $sSeparator = '.';
404 404
         }
405
-        if(!($sNamespace = trim($sNamespace, ' \\')))
405
+        if (!($sNamespace = trim($sNamespace, ' \\')))
406 406
         {
407 407
             $sNamespace = '';
408 408
         }
409
-        if(($sNamespace))
409
+        if (($sNamespace))
410 410
         {
411 411
             // If there is an autoloader, register the dir with PSR4 autoloading
412
-            if(($this->xAutoloader))
412
+            if (($this->xAutoloader))
413 413
             {
414 414
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
415 415
             }
416 416
         }
417
-        elseif(($this->xAutoloader))
417
+        elseif (($this->xAutoloader))
418 418
         {
419 419
             // If there is an autoloader, register the dir with classmap autoloading
420 420
             $itDir = new RecursiveDirectoryIterator($sDirectory);
421 421
             $itFile = new RecursiveIteratorIterator($itDir);
422 422
             // Iterate on dir content
423
-            foreach($itFile as $xFile)
423
+            foreach ($itFile as $xFile)
424 424
             {
425 425
                 // skip everything except PHP files
426
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
426
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
427 427
                 {
428 428
                     continue;
429 429
                 }
@@ -459,33 +459,33 @@  discard block
 block discarded – undo
459 459
         $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
460 460
         $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS));
461 461
         $sClassName = $xFile->getBasename('.php');
462
-        if(($sNamespace))
462
+        if (($sNamespace))
463 463
         {
464 464
             $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace;
465 465
             $sClassName = '\\' . $sClassPath . '\\' . $sClassName;
466 466
         }
467 467
         // Require the file only if autoload is enabled but there is no autoloader
468
-        if(($this->bAutoloadEnabled) && !($this->xAutoloader))
468
+        if (($this->bAutoloadEnabled) && !($this->xAutoloader))
469 469
         {
470 470
             require_once($xFile->getPathname());
471 471
         }
472 472
         // Create and register an instance of the class
473
-        if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
473
+        if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
474 474
         {
475 475
             $aOptions['*'] = array();
476 476
         }
477 477
         $aOptions['*']['separator'] = $sSeparator;
478
-        if(($sNamespace))
478
+        if (($sNamespace))
479 479
         {
480 480
             $aOptions['*']['namespace'] = $sNamespace;
481 481
         }
482
-        if(($sClassPath))
482
+        if (($sClassPath))
483 483
         {
484 484
             $aOptions['*']['classpath'] = $sClassPath;
485 485
         }
486 486
         // Filter excluded methods
487
-        $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);});
488
-        if(count($aProtected) > 0)
487
+        $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); });
488
+        if (count($aProtected) > 0)
489 489
         {
490 490
             $aOptions['*']['protected'] = $aProtected;
491 491
         }
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
         $sDS = DIRECTORY_SEPARATOR;
505 505
         // Change the keys in $aOptions to have "\" as separator
506 506
         $aNewOptions = array();
507
-        foreach($aOptions as $key => $aOption)
507
+        foreach ($aOptions as $key => $aOption)
508 508
         {
509 509
             $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\');
510 510
             $aNewOptions[$key] = $aOption;
511 511
         }
512 512
 
513
-        foreach($this->aClassDirs as $aClassDir)
513
+        foreach ($this->aClassDirs as $aClassDir)
514 514
         {
515 515
             // Get the directory
516 516
             $sDirectory = $aClassDir['directory'];
@@ -520,10 +520,10 @@  discard block
 block discarded – undo
520 520
             $itDir = new RecursiveDirectoryIterator($sDirectory);
521 521
             $itFile = new RecursiveIteratorIterator($itDir);
522 522
             // Iterate on dir content
523
-            foreach($itFile as $xFile)
523
+            foreach ($itFile as $xFile)
524 524
             {
525 525
                 // skip everything except PHP files
526
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
526
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
527 527
                 {
528 528
                     continue;
529 529
                 }
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
                 $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
533 533
                 $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\');
534 534
                 $sClassName = $sClassPath . '\\' . $xFile->getBasename('.php');
535
-                if(($sNamespace))
535
+                if (($sNamespace))
536 536
                 {
537 537
                     $sClassName = $sNamespace . '\\' . $sClassName;
538 538
                 }
539 539
                 // Get the class options
540 540
                 $aClassOptions = [];
541
-                if(array_key_exists($sClassName, $aNewOptions))
541
+                if (array_key_exists($sClassName, $aNewOptions))
542 542
                 {
543 543
                     $aClassOptions = $aNewOptions[$sClassName];
544 544
                 }
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
      */
560 560
     public function registerClass($sClassName, array $aOptions = array())
561 561
     {
562
-        if(!($sClassName = trim($sClassName, ' \\._')))
562
+        if (!($sClassName = trim($sClassName, ' \\._')))
563 563
         {
564 564
             return false;
565 565
         }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         // Replace "." and "_" with antislashes, and set the class path.
569 569
         $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName);
570 570
         $sClassPath = '';
571
-        if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false)
571
+        if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false)
572 572
         {
573 573
             $sClassPath = substr($sClassName, 0, $nLastSlashPosition);
574 574
             $sClassName = substr($sClassName, $nLastSlashPosition + 1);
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
         $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php';
578 578
 
579 579
         // Search for the class file in all directories.
580
-        foreach($this->aClassDirs as $aClassDir)
580
+        foreach ($this->aClassDirs as $aClassDir)
581 581
         {
582 582
             // Get the separator
583 583
             $sSeparator = $aClassDir['separator'];
@@ -586,15 +586,15 @@  discard block
 block discarded – undo
586 586
             $nLen = strlen($sNamespace);
587 587
             $sFullPath = '';
588 588
             // Check if the class belongs to the namespace
589
-            if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace)
589
+            if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace)
590 590
             {
591 591
                 $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1);
592 592
             }
593
-            elseif(!($sNamespace))
593
+            elseif (!($sNamespace))
594 594
             {
595 595
                 $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath;
596 596
             }
597
-            if(($sFullPath) && is_file($sFullPath))
597
+            if (($sFullPath) && is_file($sFullPath))
598 598
             {
599 599
                 // Found the file in this directory
600 600
                 $xFileInfo = new \SplFileInfo($sFullPath);
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
     {
619 619
         $xObject = null; // The user registered object
620 620
         $xPlugin = $this->getRequestPlugin('CallableObject'); // The CallableObject plugin
621
-        if(($xPlugin))
621
+        if (($xPlugin))
622 622
         {
623 623
             $xObject = $xPlugin->getRegisteredObject($sClassName);
624 624
         }
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      */
633 633
     private function getJsLibUri()
634 634
     {
635
-        if(!$this->hasOption('js.lib.uri'))
635
+        if (!$this->hasOption('js.lib.uri'))
636 636
         {
637 637
             return 'https://cdn.jsdelivr.net/jaxon/1.2.0/';
638 638
         }
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
         $jsDelivrUri = 'https://cdn.jsdelivr.net';
653 653
         $nLen = strlen($jsDelivrUri);
654 654
         // The jsDelivr CDN only hosts minified files
655
-        if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri)
655
+        if (($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri)
656 656
         {
657 657
             return '.min.js';
658 658
         }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         // Check config options
670 670
         // - The js.app.extern option must be set to true
671 671
         // - The js.app.uri and js.app.dir options must be set to non null values
672
-        if(!$this->getOption('js.app.extern') ||
672
+        if (!$this->getOption('js.app.extern') ||
673 673
             !$this->getOption('js.app.uri') ||
674 674
             !$this->getOption('js.app.dir'))
675 675
         {
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         // Check dir access
679 679
         // - The js.app.dir must be writable
680 680
         $sJsAppDir = $this->getOption('js.app.dir');
681
-        if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
681
+        if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
682 682
         {
683 683
             return false;
684 684
         }
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
      */
693 693
     private function setTemplateCacheDir()
694 694
     {
695
-        if($this->hasOption('core.template.cache_dir'))
695
+        if ($this->hasOption('core.template.cache_dir'))
696 696
         {
697 697
             $this->setCacheDir($this->getOption('core.template.cache_dir'));
698 698
         }
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 
715 715
         // Add component files to the javascript file array;
716 716
         $aJsFiles = array($sJsCoreUrl);
717
-        if($this->getOption('core.debug.on'))
717
+        if ($this->getOption('core.debug.on'))
718 718
         {
719 719
             $aJsFiles[] = $sJsDebugUrl;
720 720
             $aJsFiles[] = $sJsLanguageUrl;
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
             'sJsOptions' => $this->getOption('js.app.options'),
731 731
             'aUrls' => $aJsFiles,
732 732
         ));
733
-        foreach($this->aResponsePlugins as $xPlugin)
733
+        foreach ($this->aResponsePlugins as $xPlugin)
734 734
         {
735 735
             $sCode .= rtrim($xPlugin->getJs(), " \n") . "\n";
736 736
         }
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
         $this->setTemplateCacheDir();
749 749
 
750 750
         $sCode = '';
751
-        foreach($this->aResponsePlugins as $xPlugin)
751
+        foreach ($this->aResponsePlugins as $xPlugin)
752 752
         {
753 753
             $sCode .= rtrim($xPlugin->getCss(), " \n") . "\n";
754 754
         }
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
         ));
837 837
 
838 838
         $sPluginScript = '';
839
-        foreach($this->aResponsePlugins as $xPlugin)
839
+        foreach ($this->aResponsePlugins as $xPlugin)
840 840
         {
841 841
             $sPluginScript .= "\n" . trim($xPlugin->getScript(), " \n");
842 842
         }
@@ -865,7 +865,7 @@  discard block
 block discarded – undo
865 865
     {
866 866
         // Get the config and plugins scripts
867 867
         $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n";
868
-        foreach($this->aRequestPlugins as $xPlugin)
868
+        foreach ($this->aRequestPlugins as $xPlugin)
869 869
         {
870 870
             $sScript .= "\n" . trim($xPlugin->getScript(), " \n");
871 871
         }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
         // Set the template engine cache dir
888 888
         $this->setTemplateCacheDir();
889 889
 
890
-        if($this->canExportJavascript())
890
+        if ($this->canExportJavascript())
891 891
         {
892 892
             $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/';
893 893
             $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/';
@@ -896,13 +896,13 @@  discard block
 block discarded – undo
896 896
             $sHash = $this->generateHash();
897 897
             $sOutFile = $sHash . '.js';
898 898
             $sMinFile = $sHash . '.min.js';
899
-            if(!is_file($sJsAppDir . $sOutFile))
899
+            if (!is_file($sJsAppDir . $sOutFile))
900 900
             {
901 901
                 file_put_contents($sJsAppDir . $sOutFile, $this->getAllScripts());
902 902
             }
903
-            if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
903
+            if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
904 904
             {
905
-                if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
905
+                if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
906 906
                 {
907 907
                     $sOutFile = $sMinFile;
908 908
                 }
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
      */
936 936
     public function getResponsePlugin($sName)
937 937
     {
938
-        if(array_key_exists($sName, $this->aResponsePlugins))
938
+        if (array_key_exists($sName, $this->aResponsePlugins))
939 939
         {
940 940
             return $this->aResponsePlugins[$sName];
941 941
         }
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
      */
952 952
     public function getRequestPlugin($sName)
953 953
     {
954
-        if(array_key_exists($sName, $this->aRequestPlugins))
954
+        if (array_key_exists($sName, $this->aRequestPlugins))
955 955
         {
956 956
             return $this->aRequestPlugins[$sName];
957 957
         }
Please login to merge, or discard this patch.
src/Request/Manager.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
      *
153 153
      * @param string        $sArg                The Jaxon request argument
154 154
      *
155
-     * @return mixed
155
+     * @return string|null
156 156
      */
157 157
     private function __argumentDecode(&$sArg)
158 158
     {
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -131,19 +131,19 @@
 block discarded – undo
131 131
         $sValue = substr($sValue, 1);
132 132
         switch ($cType)
133 133
         {
134
-            case 'S':
135
-                $value = ($sValue === false ? '' : $sValue);
136
-                break;
137
-            case 'B':
138
-                $value = $this->__convertStringToBool($sValue);
139
-                break;
140
-            case 'N':
141
-                $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
-                break;
143
-            case '*':
144
-            default:
145
-                $value = null;
146
-                break;
134
+        case 'S':
135
+            $value = ($sValue === false ? '' : $sValue);
136
+            break;
137
+        case 'B':
138
+            $value = $this->__convertStringToBool($sValue);
139
+            break;
140
+        case 'N':
141
+            $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
+            break;
143
+        case '*':
144
+        default:
145
+            $value = null;
146
+            break;
147 147
         }
148 148
         return $value;
149 149
     }
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
         $this->aArgs = array();
56 56
         $this->nMethod = Jaxon::METHOD_UNKNOWN;
57 57
         
58
-        if(isset($_POST['jxnargs']))
58
+        if (isset($_POST['jxnargs']))
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62 62
         }
63
-        elseif(isset($_GET['jxnargs']))
63
+        elseif (isset($_GET['jxnargs']))
64 64
         {
65 65
             $this->nMethod = Jaxon::METHOD_GET;
66 66
             $this->aArgs = $_GET['jxnargs'];
67 67
         }
68
-        if(get_magic_quotes_gpc() == 1)
68
+        if (get_magic_quotes_gpc() == 1)
69 69
         {
70 70
             array_walk($this->aArgs, array(&$this, '__argumentStripSlashes'));
71 71
         }
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private function __convertStringToBool($sValue)
83 83
     {
84
-        if(strcasecmp($sValue, 'true') == 0)
84
+        if (strcasecmp($sValue, 'true') == 0)
85 85
         {
86 86
             return true;
87 87
         }
88
-        if(strcasecmp($sValue, 'false') == 0)
88
+        if (strcasecmp($sValue, 'false') == 0)
89 89
         {
90 90
             return false;
91 91
         }
92
-        if(is_numeric($sValue))
92
+        if (is_numeric($sValue))
93 93
         {
94
-            if($sValue == 0)
94
+            if ($sValue == 0)
95 95
             {
96 96
                 return false;
97 97
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function __argumentStripSlashes(&$sArg)
111 111
     {
112
-        if(!is_string($sArg))
112
+        if (!is_string($sArg))
113 113
         {
114 114
             return '';
115 115
         }
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
      */
158 158
     private function __argumentDecode(&$sArg)
159 159
     {
160
-        if($sArg == '')
160
+        if ($sArg == '')
161 161
         {
162 162
             return '';
163 163
         }
164 164
 
165 165
         $data = json_decode($sArg, true);
166 166
 
167
-        if($data !== null && $sArg != $data)
167
+        if ($data !== null && $sArg != $data)
168 168
         {
169 169
             $sArg = $data;
170 170
         }
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
      */
184 184
     private function __argumentDecodeUTF8_iconv(&$mArg)
185 185
     {
186
-        if(is_array($mArg))
186
+        if (is_array($mArg))
187 187
         {
188
-            foreach($mArg as $sKey => $xArg)
188
+            foreach ($mArg as $sKey => $xArg)
189 189
             {
190 190
                 $sNewKey = $sKey;
191 191
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
192
-                if($sNewKey != $sKey)
192
+                if ($sNewKey != $sKey)
193 193
                 {
194 194
                     $mArg[$sNewKey] = $xArg;
195 195
                     unset($mArg[$sKey]);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
                 $this->__argumentDecodeUTF8_iconv($xArg);
199 199
             }
200 200
         }
201
-        elseif(is_string($mArg))
201
+        elseif (is_string($mArg))
202 202
         {
203 203
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
204 204
         }
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
      */
214 214
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
215 215
     {
216
-        if(is_array($mArg))
216
+        if (is_array($mArg))
217 217
         {
218
-            foreach($mArg as $sKey => $xArg)
218
+            foreach ($mArg as $sKey => $xArg)
219 219
             {
220 220
                 $sNewKey = $sKey;
221 221
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
222
-                if($sNewKey != $sKey)
222
+                if ($sNewKey != $sKey)
223 223
                 {
224 224
                     $mArg[$sNewKey] = $xArg;
225 225
                     unset($mArg[$sKey]);
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
229 229
             }
230 230
         }
231
-        elseif(is_string($mArg))
231
+        elseif (is_string($mArg))
232 232
         {
233 233
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
234 234
         }
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
      */
244 244
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
245 245
     {
246
-        if(is_array($mArg))
246
+        if (is_array($mArg))
247 247
         {
248
-            foreach($mArg as $sKey => $xArg)
248
+            foreach ($mArg as $sKey => $xArg)
249 249
             {
250 250
                 $sNewKey = $sKey;
251 251
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
252 252
                 
253
-                if($sNewKey != $sKey)
253
+                if ($sNewKey != $sKey)
254 254
                 {
255 255
                     $mArg[$sNewKey] = $xArg;
256 256
                     unset($mArg[$sKey]);
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
261 261
             }
262 262
         }
263
-        elseif(is_string($mArg))
263
+        elseif (is_string($mArg))
264 264
         {
265 265
             $mArg = utf8_decode($mArg);
266 266
         }
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function process()
287 287
     {
288
-        if(($this->getOption('core.decode_utf8')))
288
+        if (($this->getOption('core.decode_utf8')))
289 289
         {
290 290
             $sFunction = '';
291 291
             
292
-            if(function_exists('iconv'))
292
+            if (function_exists('iconv'))
293 293
             {
294 294
                 $sFunction = "iconv";
295 295
             }
296
-            elseif(function_exists('mb_convert_encoding'))
296
+            elseif (function_exists('mb_convert_encoding'))
297 297
             {
298 298
                 $sFunction = "mb_convert_encoding";
299 299
             }
300
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
300
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
301 301
             {
302 302
                 $sFunction = "utf8_decode";
303 303
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62
-        }
63
-        elseif(isset($_GET['jxnargs']))
62
+        } elseif(isset($_GET['jxnargs']))
64 63
         {
65 64
             $this->nMethod = Jaxon::METHOD_GET;
66 65
             $this->aArgs = $_GET['jxnargs'];
@@ -167,8 +166,7 @@  discard block
 block discarded – undo
167 166
         if($data !== null && $sArg != $data)
168 167
         {
169 168
             $sArg = $data;
170
-        }
171
-        else
169
+        } else
172 170
         {
173 171
             $sArg = $this->__convertValue($sArg);
174 172
         }
@@ -197,8 +195,7 @@  discard block
 block discarded – undo
197 195
                 }
198 196
                 $this->__argumentDecodeUTF8_iconv($xArg);
199 197
             }
200
-        }
201
-        elseif(is_string($mArg))
198
+        } elseif(is_string($mArg))
202 199
         {
203 200
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
204 201
         }
@@ -227,8 +224,7 @@  discard block
 block discarded – undo
227 224
                 }
228 225
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
229 226
             }
230
-        }
231
-        elseif(is_string($mArg))
227
+        } elseif(is_string($mArg))
232 228
         {
233 229
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
234 230
         }
@@ -259,8 +255,7 @@  discard block
 block discarded – undo
259 255
                 
260 256
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
261 257
             }
262
-        }
263
-        elseif(is_string($mArg))
258
+        } elseif(is_string($mArg))
264 259
         {
265 260
             $mArg = utf8_decode($mArg);
266 261
         }
@@ -292,16 +287,13 @@  discard block
 block discarded – undo
292 287
             if(function_exists('iconv'))
293 288
             {
294 289
                 $sFunction = "iconv";
295
-            }
296
-            elseif(function_exists('mb_convert_encoding'))
290
+            } elseif(function_exists('mb_convert_encoding'))
297 291
             {
298 292
                 $sFunction = "mb_convert_encoding";
299
-            }
300
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
293
+            } elseif($this->getOption('core.encoding') == "ISO-8859-1")
301 294
             {
302 295
                 $sFunction = "utf8_decode";
303
-            }
304
-            else
296
+            } else
305 297
             {
306 298
                 throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion'));
307 299
             }
Please login to merge, or discard this patch.
src/Request/Plugin/UserFunction.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 
24 24
 use Jaxon\Jaxon;
25 25
 use Jaxon\Plugin\Request as RequestPlugin;
26
-use Jaxon\Request\Manager as RequestManager;
27 26
 
28 27
 class UserFunction extends RequestPlugin
29 28
 {
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 
52 52
         $this->sRequestedFunction = null;
53 53
         
54
-        if(isset($_GET['jxnfun']))
54
+        if (isset($_GET['jxnfun']))
55 55
         {
56 56
             $this->sRequestedFunction = $_GET['jxnfun'];
57 57
         }
58
-        if(isset($_POST['jxnfun']))
58
+        if (isset($_POST['jxnfun']))
59 59
         {
60 60
             $this->sRequestedFunction = $_POST['jxnfun'];
61 61
         }
@@ -80,22 +80,22 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function register($aArgs)
82 82
     {
83
-        if(count($aArgs) > 1)
83
+        if (count($aArgs) > 1)
84 84
         {
85 85
             $sType = $aArgs[0];
86 86
 
87
-            if($sType == Jaxon::USER_FUNCTION)
87
+            if ($sType == Jaxon::USER_FUNCTION)
88 88
             {
89 89
                 $xUserFunction = $aArgs[1];
90 90
 
91
-                if(!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction))
91
+                if (!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction))
92 92
                     $xUserFunction = new \Jaxon\Request\Support\UserFunction($xUserFunction);
93 93
 
94
-                if(count($aArgs) > 2)
94
+                if (count($aArgs) > 2)
95 95
                 {
96
-                    if(is_array($aArgs[2]))
96
+                    if (is_array($aArgs[2]))
97 97
                     {
98
-                        foreach($aArgs[2] as $sName => $sValue)
98
+                        foreach ($aArgs[2] as $sName => $sValue)
99 99
                         {
100 100
                             $xUserFunction->configure($sName, $sValue);
101 101
                         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     public function generateHash()
123 123
     {
124 124
         $sHash = '';
125
-        foreach($this->aFunctions as $xFunction)
125
+        foreach ($this->aFunctions as $xFunction)
126 126
         {
127 127
             $sHash .= $xFunction->getName();
128 128
         }
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     public function getScript()
138 138
     {
139 139
         $code = '';
140
-        foreach($this->aFunctions as $xFunction)
140
+        foreach ($this->aFunctions as $xFunction)
141 141
         {
142 142
             $code .= $xFunction->getScript();
143 143
         }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     public function canProcessRequest()
153 153
     {
154 154
         // Check the validity of the function name
155
-        if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
155
+        if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
156 156
         {
157 157
             $this->sRequestedFunction = null;
158 158
         }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function processRequest()
168 168
     {
169
-        if(!$this->canProcessRequest())
169
+        if (!$this->canProcessRequest())
170 170
             return false;
171 171
 
172 172
         $aArgs = $this->getRequestManager()->process();
173 173
 
174
-        if(array_key_exists($this->sRequestedFunction, $this->aFunctions))
174
+        if (array_key_exists($this->sRequestedFunction, $this->aFunctions))
175 175
         {
176 176
             $this->aFunctions[$this->sRequestedFunction]->call($aArgs);
177 177
             return true;
Please login to merge, or discard this patch.
Braces   +7 added lines, -6 removed lines patch added patch discarded remove patch
@@ -88,8 +88,9 @@  discard block
 block discarded – undo
88 88
             {
89 89
                 $xUserFunction = $aArgs[1];
90 90
 
91
-                if(!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction))
92
-                    $xUserFunction = new \Jaxon\Request\Support\UserFunction($xUserFunction);
91
+                if(!($xUserFunction instanceof \Jaxon\Request\Support\UserFunction)) {
92
+                                    $xUserFunction = new \Jaxon\Request\Support\UserFunction($xUserFunction);
93
+                }
93 94
 
94 95
                 if(count($aArgs) > 2)
95 96
                 {
@@ -99,8 +100,7 @@  discard block
 block discarded – undo
99 100
                         {
100 101
                             $xUserFunction->configure($sName, $sValue);
101 102
                         }
102
-                    }
103
-                    else
103
+                    } else
104 104
                     {
105 105
                         $xUserFunction->configure('include', $aArgs[2]);
106 106
                     }
@@ -166,8 +166,9 @@  discard block
 block discarded – undo
166 166
      */
167 167
     public function processRequest()
168 168
     {
169
-        if(!$this->canProcessRequest())
170
-            return false;
169
+        if(!$this->canProcessRequest()) {
170
+                    return false;
171
+        }
171 172
 
172 173
         $aArgs = $this->getRequestManager()->process();
173 174
 
Please login to merge, or discard this patch.
src/Request/Request.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 
21 21
 namespace Jaxon\Request;
22 22
 
23
-use JsonSerializable;
24 23
 use Jaxon\Jaxon;
25 24
 
26 25
 class Request extends JsCall
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
                     $aVariables[$sParameterStr] = $sVarName;
192 192
                     $sVars .= "$sVarName=$xParameter;";
193 193
                     $nVarId++;
194
-                }
195
-                else
194
+                } else
196 195
                 {
197 196
                     // The value is already defined. The corresponding variable is assigned.
198 197
                     $sVarName = $aVariables[$sParameterStr];
@@ -221,8 +220,7 @@  discard block
 block discarded – undo
221 220
                             $aVariables[$sParameterStr] = $sVarName;
222 221
                             $sVars .= "$sVarName=$xParameter;";
223 222
                             $nVarId++;
224
-                        }
225
-                        else
223
+                        } else
226 224
                         {
227 225
                             // The value is already defined. The corresponding variable is assigned.
228 226
                             $sVarName = $aVariables[$sParameterStr];
@@ -241,8 +239,7 @@  discard block
 block discarded – undo
241 239
         {
242 240
             $xConfirm = $this->getPluginManager()->getConfirm();
243 241
             $sScript = $xConfirm->confirm($sPhrase, $sScript, '');
244
-        }
245
-        elseif($this->sCondition !== null)
242
+        } elseif($this->sCondition !== null)
246 243
         {
247 244
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
248 245
             if(($sPhrase))
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function hasPageNumber()
72 72
     {
73
-        foreach($this->aParameters as $xParameter)
73
+        foreach ($this->aParameters as $xParameter)
74 74
         {
75
-            if($xParameter->getType() == Jaxon::PAGE_NUMBER)
75
+            if ($xParameter->getType() == Jaxon::PAGE_NUMBER)
76 76
             {
77 77
                 return true;
78 78
             }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
     public function setPageNumber($nPageNumber)
91 91
     {
92 92
         // Set the value of the Jaxon::PAGE_NUMBER parameter
93
-        foreach($this->aParameters as $xParameter)
93
+        foreach ($this->aParameters as $xParameter)
94 94
         {
95
-            if($xParameter->getType() == Jaxon::PAGE_NUMBER)
95
+            if ($xParameter->getType() == Jaxon::PAGE_NUMBER)
96 96
             {
97 97
                 $xParameter->setValue(intval($nPageNumber));
98 98
                 break;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     {
113 113
         $this->sCondition = '__confirm__';
114 114
         $this->aMessageArgs = func_get_args();
115
-        array_walk($this->aMessageArgs, function (&$xParameter) {
115
+        array_walk($this->aMessageArgs, function(&$xParameter) {
116 116
             $xParameter = Parameter::make($xParameter);
117 117
         });
118 118
         return $this;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     public function elseShow($sMessage)
246 246
     {
247 247
         $this->aMessageArgs = func_get_args();
248
-        array_walk($this->aMessageArgs, function (&$xParameter) {
248
+        array_walk($this->aMessageArgs, function(&$xParameter) {
249 249
             $xParameter = Parameter::make($xParameter);
250 250
         });
251 251
         return $this;
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
         // This array will avoid declaring multiple variables with the same value.
271 271
         // The array key is the variable value, while the array value is the variable name.
272 272
         $aVariables = array(); // Array of local variables.
273
-        foreach($this->aParameters as &$xParameter)
273
+        foreach ($this->aParameters as &$xParameter)
274 274
         {
275 275
             $sParameterStr = $xParameter->getScript();
276
-            if($xParameter instanceof \Jaxon\JQuery\Dom\Element)
276
+            if ($xParameter instanceof \Jaxon\JQuery\Dom\Element)
277 277
             {
278
-                if(!array_key_exists($sParameterStr, $aVariables))
278
+                if (!array_key_exists($sParameterStr, $aVariables))
279 279
                 {
280 280
                     // The value is not yet defined. A new variable is created.
281 281
                     $sVarName = "jxnVar$nVarId";
@@ -293,19 +293,19 @@  discard block
 block discarded – undo
293 293
         }
294 294
 
295 295
         $sPhrase = '';
296
-        if(count($this->aMessageArgs) > 0)
296
+        if (count($this->aMessageArgs) > 0)
297 297
         {
298 298
             $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question.
299 299
             // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes
300
-            if(count($this->aMessageArgs) > 0)
300
+            if (count($this->aMessageArgs) > 0)
301 301
             {
302 302
                 $nParamId = 1;
303
-                foreach($this->aMessageArgs as &$xParameter)
303
+                foreach ($this->aMessageArgs as &$xParameter)
304 304
                 {
305 305
                     $sParameterStr = $xParameter->getScript();
306
-                    if($xParameter instanceof \Jaxon\JQuery\Dom\Element)
306
+                    if ($xParameter instanceof \Jaxon\JQuery\Dom\Element)
307 307
                     {
308
-                        if(!array_key_exists($sParameterStr, $aVariables))
308
+                        if (!array_key_exists($sParameterStr, $aVariables))
309 309
                         {
310 310
                             // The value is not yet defined. A new variable is created.
311 311
                             $sVarName = "jxnVar$nVarId";
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         }
329 329
 
330 330
         $sScript = $this->getOption('core.prefix.' . $this->sType) . parent::getScript();
331
-        if($this->sCondition == '__confirm__')
331
+        if ($this->sCondition == '__confirm__')
332 332
         {
333 333
             $xConfirm = $this->getPluginManager()->getConfirm();
334 334
             $sScript = $xConfirm->confirm($sPhrase, $sScript, '');
335 335
         }
336
-        elseif($this->sCondition !== null)
336
+        elseif ($this->sCondition !== null)
337 337
         {
338 338
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
339
-            if(($sPhrase))
339
+            if (($sPhrase))
340 340
             {
341 341
                 $xAlert = $this->getPluginManager()->getAlert();
342 342
                 $xAlert->setReturn(true);
Please login to merge, or discard this patch.
src/Request/Support/UserFunction.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@
 block discarded – undo
158 158
     /**
159 159
      * Constructs and returns a <Jaxon\Request\Request> object which is capable of generating the javascript call to invoke this jaxon enabled function
160 160
      *
161
-     * @return Jaxon\Request\Request
161
+     * @return Request
162 162
      */
163 163
     public function generateRequest()
164 164
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,17 +100,14 @@
 block discarded – undo
100 100
             {
101 101
                 $this->sAlias = $sUserFunction[0];
102 102
                 $this->sUserFunction = array_slice($sUserFunction, 1);
103
-            }
104
-            else
103
+            } else
105 104
             {
106 105
                 $this->sUserFunction = $sUserFunction;
107 106
             }
108
-        }
109
-        elseif(is_string($sUserFunction))
107
+        } elseif(is_string($sUserFunction))
110 108
         {
111 109
             $this->sUserFunction = $sUserFunction;
112
-        }
113
-        else
110
+        } else
114 111
         {
115 112
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
116 113
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -90,13 +90,13 @@  discard block
 block discarded – undo
90 90
     {
91 91
         $this->aConfiguration = array();
92 92
         $this->sAlias = '';
93
-        if(is_array($sUserFunction))
93
+        if (is_array($sUserFunction))
94 94
         {
95
-            if(count($sUserFunction) != 2 && count($sUserFunction) != 3)
95
+            if (count($sUserFunction) != 2 && count($sUserFunction) != 3)
96 96
             {
97 97
                 throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
98 98
             }
99
-            if(count($sUserFunction) == 3)
99
+            if (count($sUserFunction) == 3)
100 100
             {
101 101
                 $this->sAlias = $sUserFunction[0];
102 102
                 $this->sUserFunction = array_slice($sUserFunction, 1);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 $this->sUserFunction = $sUserFunction;
107 107
             }
108 108
         }
109
-        elseif(is_string($sUserFunction))
109
+        elseif (is_string($sUserFunction))
110 110
         {
111 111
             $this->sUserFunction = $sUserFunction;
112 112
         }
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     public function getName()
125 125
     {
126 126
         // Do not use sAlias here!
127
-        if(is_array($this->sUserFunction))
127
+        if (is_array($this->sUserFunction))
128 128
         {
129 129
             return $this->sUserFunction[1];
130 130
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
      */
142 142
     public function configure($sName, $sValue)
143 143
     {
144
-        switch($sName)
144
+        switch ($sName)
145 145
         {
146 146
         case 'alias':
147 147
             $this->sAlias = $sValue;
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     public function call($aArgs = array())
197 197
     {
198
-        if(($this->sInclude))
198
+        if (($this->sInclude))
199 199
         {
200 200
             require_once $this->sInclude;
201 201
         }
Please login to merge, or discard this patch.
src/Request/Traits/Factory.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,6 @@  discard block
 block discarded – undo
89 89
      * Return the javascript call to an Jaxon object method
90 90
      *
91 91
      * @param string         $sMethod           The method (without class) name
92
-     * @param ...            $xParams           The parameters of the method
93 92
      *
94 93
      * @return object
95 94
      */
@@ -110,7 +109,6 @@  discard block
 block discarded – undo
110 109
      * @param integer $nItemsPerPage the number of items per page
111 110
      * @param integer $nCurrentPage the current page
112 111
      * @param string  $sMethod the name of the method
113
-     * @param ... $parameters the parameters of the method
114 112
      *
115 113
      * @return string the pagination links
116 114
      */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
      */
45 45
     public function getJaxonClassName()
46 46
     {
47
-        if(!$this->xJaxonCallable)
47
+        if (!$this->xJaxonCallable)
48 48
         {
49 49
             // Make the Jaxon class name for a class without an associated callable
50 50
             // !! Warning !! This can happen only if this object is not registered with the Jaxon libary
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function getJaxonNamespace()
64 64
     {
65
-        if(!$this->xJaxonCallable)
65
+        if (!$this->xJaxonCallable)
66 66
         {
67 67
             // Return an empty string.
68 68
             return '';
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      */
78 78
     public function getJaxonClassPath()
79 79
     {
80
-        if(!$this->xJaxonCallable)
80
+        if (!$this->xJaxonCallable)
81 81
         {
82 82
             // Return an empty string.
83 83
             return '';
Please login to merge, or discard this patch.
src/Utils/Container.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@
 block discarded – undo
201 201
     /**
202 202
      * Create a new the config manager
203 203
      *
204
-     * @return Jaxon\Utils\Config\Config            The config manager
204
+     * @return Config\Config            The config manager
205 205
      */
206 206
     public function newConfig()
207 207
     {
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
     public static function getInstance()
29 29
     {
30
-        if(!self::$xInstance)
30
+        if (!self::$xInstance)
31 31
         {
32 32
             self::$xInstance = new Container();
33 33
         }
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
          * Managers
66 66
          */
67 67
         // Plugin Manager
68
-        $this->di['plugin_manager'] = function ($c) {
68
+        $this->di['plugin_manager'] = function($c) {
69 69
             return new \Jaxon\Plugin\Manager();
70 70
         };
71 71
         // Request Manager
72
-        $this->di['request_manager'] = function ($c) {
72
+        $this->di['request_manager'] = function($c) {
73 73
             return new \Jaxon\Request\Manager();
74 74
         };
75 75
         // Request Factory
76
-        $this->di['request_factory'] = function ($c) {
76
+        $this->di['request_factory'] = function($c) {
77 77
             return new \Jaxon\Request\Factory();
78 78
         };
79 79
         // Response Manager
80
-        $this->di['response_manager'] = function ($c) {
80
+        $this->di['response_manager'] = function($c) {
81 81
             return new \Jaxon\Response\Manager();
82 82
         };
83 83
 
@@ -85,35 +85,35 @@  discard block
 block discarded – undo
85 85
          * Services
86 86
          */
87 87
         // Config manager
88
-        $this->di['config'] = function ($c) {
88
+        $this->di['config'] = function($c) {
89 89
             return new Config\Config();
90 90
         };
91 91
         // Minifier
92
-        $this->di['minifier'] = function ($c) {
92
+        $this->di['minifier'] = function($c) {
93 93
             return new Template\Minifier();
94 94
         };
95 95
         // Translator
96
-        $this->di['translator'] = function ($c) {
96
+        $this->di['translator'] = function($c) {
97 97
             return new Translation\Translator($c['translation_dir'], $c['config']);
98 98
         };
99 99
         // Template engine
100
-        $this->di['template'] = function ($c) {
100
+        $this->di['template'] = function($c) {
101 101
             return new Template\Template($c['template_dir']);
102 102
         };
103 103
         // Validator
104
-        $this->di['validator'] = function ($c) {
104
+        $this->di['validator'] = function($c) {
105 105
             return new Validation\Validator($c['translator'], $c['config']);
106 106
         };
107 107
         // Pagination Renderer
108
-        $this->di['pagination.renderer'] = function ($c) {
108
+        $this->di['pagination.renderer'] = function($c) {
109 109
             return new Pagination\Renderer();
110 110
         };
111 111
         // Pagination Paginator
112
-        $this->di['pagination.paginator'] = function ($c) {
112
+        $this->di['pagination.paginator'] = function($c) {
113 113
             return new Pagination\Paginator($c['pagination.renderer']);
114 114
         };
115 115
         // Event Dispatcher
116
-        $this->di['events'] = function ($c) {
116
+        $this->di['events'] = function($c) {
117 117
             return new EventDispatcher();
118 118
         };
119 119
 
@@ -121,27 +121,27 @@  discard block
 block discarded – undo
121 121
          * Core library objects
122 122
          */
123 123
         // Global Response
124
-        $this->di['response'] = function ($c) {
124
+        $this->di['response'] = function($c) {
125 125
             return new \Jaxon\Response\Response();
126 126
         };
127 127
         // Jaxon Core
128
-        $this->di['jaxon'] = function ($c) {
128
+        $this->di['jaxon'] = function($c) {
129 129
             return new \Jaxon\Jaxon();
130 130
         };
131 131
         // Jaxon Sentry
132
-        $this->di['sentry'] = function ($c) {
132
+        $this->di['sentry'] = function($c) {
133 133
             // This class is not defined in this package
134 134
             $sClass = '\\Jaxon\\Sentry\\Sentry';
135 135
             return new $sClass;
136 136
         };
137 137
         // Armada
138
-        $this->di['armada'] = function ($c) {
138
+        $this->di['armada'] = function($c) {
139 139
             // This class is not defined in this package
140 140
             $sClass = '\\Jaxon\\Armada\\Armada';
141 141
             return new $sClass;
142 142
         };
143 143
         // View Renderer Facade
144
-        $this->di['sentry.view.renderer'] = function ($c) {
144
+        $this->di['sentry.view.renderer'] = function($c) {
145 145
             $aRenderers = $c['view.data.renderers'];
146 146
             $sDefaultNamespace = $c['view.data.namespace.default'];
147 147
             return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace);
@@ -391,14 +391,14 @@  discard block
 block discarded – undo
391 391
         $this->di['sentry.view.base.' . $sId] = $xClosure;
392 392
 
393 393
         // Return the initialized view renderer
394
-        $this->di['sentry.view.' . $sId] = function ($c) use ($sId) {
394
+        $this->di['sentry.view.' . $sId] = function($c) use ($sId) {
395 395
             // Get the defined renderer
396 396
             $renderer = $c['sentry.view.base.' . $sId];
397 397
             // Init the renderer with the template namespaces
398 398
             $aNamespaces = $this->di['view.data.namespaces'];
399
-            if(key_exists($sId, $aNamespaces))
399
+            if (key_exists($sId, $aNamespaces))
400 400
             {
401
-                foreach($aNamespaces[$sId] as $ns)
401
+                foreach ($aNamespaces[$sId] as $ns)
402 402
                 {
403 403
                     $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']);
404 404
                 }
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      */
417 417
     public function getViewRenderer($sId = '')
418 418
     {
419
-        if(!$sId)
419
+        if (!$sId)
420 420
         {
421 421
             // Return the view renderer facade
422 422
             return $this->di['sentry.view.renderer'];
Please login to merge, or discard this patch.
src/Utils/Pagination/Paginator.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
     }
162 162
 
163 163
     /**
164
-     * @return string
164
+     * @return Request
165 165
      */
166 166
     public function getRequest()
167 167
     {
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function updateNumPages()
67 67
     {
68
-        $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int) ceil($this->totalItems/$this->itemsPerPage));
68
+        $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int)ceil($this->totalItems / $this->itemsPerPage));
69 69
     }
70 70
 
71 71
     /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function setMaxPagesToShow($maxPagesToShow)
76 76
     {
77
-        if($maxPagesToShow < 3)
77
+        if ($maxPagesToShow < 3)
78 78
         {
79 79
             throw new \InvalidArgumentException('maxPagesToShow cannot be less than 3.');
80 80
         }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $this->request = $request;
156 156
         // Append the page number to the parameter list, if not yet given.
157
-        if(($this->request) && !$this->request->hasPageNumber())
157
+        if (($this->request) && !$this->request->hasPageNumber())
158 158
         {
159 159
             $this->request->addParameter(Jaxon::PAGE_NUMBER, 0);
160 160
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     public function getNextPage()
195 195
     {
196
-        if($this->currentPage < $this->numPages)
196
+        if ($this->currentPage < $this->numPages)
197 197
         {
198 198
             return $this->currentPage + 1;
199 199
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
     public function getPrevPage()
205 205
     {
206
-        if($this->currentPage > 1)
206
+        if ($this->currentPage > 1)
207 207
         {
208 208
             return $this->currentPage - 1;
209 209
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
     public function getNextCall()
215 215
     {
216
-        if(!$this->getNextPage())
216
+        if (!$this->getNextPage())
217 217
         {
218 218
             return null;
219 219
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function getPrevCall()
228 228
     {
229
-        if(!$this->getPrevPage())
229
+        if (!$this->getPrevPage())
230 230
         {
231 231
             return null;
232 232
         }
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $pages = array();
256 256
 
257
-        if($this->numPages <= 1)
257
+        if ($this->numPages <= 1)
258 258
         {
259 259
             return array();
260 260
         }
261 261
 
262
-        if($this->numPages <= $this->maxPagesToShow)
262
+        if ($this->numPages <= $this->maxPagesToShow)
263 263
         {
264
-            for($i = 1; $i <= $this->numPages; $i++)
264
+            for ($i = 1; $i <= $this->numPages; $i++)
265 265
             {
266 266
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
267 267
             }
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
         else
270 270
         {
271 271
             // Determine the sliding range, centered around the current page.
272
-            $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2);
272
+            $numAdjacents = (int)floor(($this->maxPagesToShow - 3) / 2);
273 273
 
274
-            if($this->currentPage + $numAdjacents > $this->numPages)
274
+            if ($this->currentPage + $numAdjacents > $this->numPages)
275 275
             {
276 276
                 $slidingStart = $this->numPages - $this->maxPagesToShow + 2;
277 277
             }
@@ -279,28 +279,28 @@  discard block
 block discarded – undo
279 279
             {
280 280
                 $slidingStart = $this->currentPage - $numAdjacents;
281 281
             }
282
-            if($slidingStart < 2)
282
+            if ($slidingStart < 2)
283 283
             {
284 284
                 $slidingStart = 2;
285 285
             }
286 286
 
287 287
             $slidingEnd = $slidingStart + $this->maxPagesToShow - 3;
288
-            if($slidingEnd >= $this->numPages)
288
+            if ($slidingEnd >= $this->numPages)
289 289
             {
290 290
                 $slidingEnd = $this->numPages - 1;
291 291
             }
292 292
 
293 293
             // Build the list of pages.
294 294
             $pages[] = $this->createPage(1, $this->currentPage == 1);
295
-            if($slidingStart > 2)
295
+            if ($slidingStart > 2)
296 296
             {
297 297
                 $pages[] = $this->createPageEllipsis();
298 298
             }
299
-            for($i = $slidingStart; $i <= $slidingEnd; $i++)
299
+            for ($i = $slidingStart; $i <= $slidingEnd; $i++)
300 300
             {
301 301
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
302 302
             }
303
-            if($slidingEnd < $this->numPages - 1)
303
+            if ($slidingEnd < $this->numPages - 1)
304 304
             {
305 305
                 $pages[] = $this->createPageEllipsis();
306 306
             }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function toHtml()
348 348
     {
349
-        if($this->getNumPages() <= 1)
349
+        if ($this->getNumPages() <= 1)
350 350
         {
351 351
             return '';
352 352
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $first = ($this->currentPage - 1) * $this->itemsPerPage + 1;
371 371
 
372
-        if($first > $this->totalItems)
372
+        if ($first > $this->totalItems)
373 373
         {
374 374
             return null;
375 375
         }
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
     public function getCurrentPageLastItem()
381 381
     {
382 382
         $first = $this->getCurrentPageFirstItem();
383
-        if($first === null)
383
+        if ($first === null)
384 384
         {
385 385
             return null;
386 386
         }
387 387
 
388 388
         $last = $first + $this->itemsPerPage - 1;
389
-        if($last > $this->totalItems)
389
+        if ($last > $this->totalItems)
390 390
         {
391 391
             return $this->totalItems;
392 392
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -265,8 +265,7 @@  discard block
 block discarded – undo
265 265
             {
266 266
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
267 267
             }
268
-        }
269
-        else
268
+        } else
270 269
         {
271 270
             // Determine the sliding range, centered around the current page.
272 271
             $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2);
@@ -274,8 +273,7 @@  discard block
 block discarded – undo
274 273
             if($this->currentPage + $numAdjacents > $this->numPages)
275 274
             {
276 275
                 $slidingStart = $this->numPages - $this->maxPagesToShow + 2;
277
-            }
278
-            else
276
+            } else
279 277
             {
280 278
                 $slidingStart = $this->currentPage - $numAdjacents;
281 279
             }
Please login to merge, or discard this patch.
src/Request/JsCall.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,9 +168,9 @@
 block discarded – undo
168 168
      */
169 169
     public function addParameters(array $aParameters)
170 170
     {
171
-        foreach($aParameters as $xParameter)
171
+        foreach ($aParameters as $xParameter)
172 172
         {
173
-            if($xParameter instanceof JsCall)
173
+            if ($xParameter instanceof JsCall)
174 174
             {
175 175
                 $this->addParameter(Jaxon::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
176 176
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,7 @@
 block discarded – undo
173 173
             if($xParameter instanceof JsCall)
174 174
             {
175 175
                 $this->addParameter(Jaxon::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
176
-            }
177
-            else
176
+            } else
178 177
             {
179 178
                 $this->pushParameter(Parameter::make($xParameter));
180 179
             }
Please login to merge, or discard this patch.