Completed
Push — master ( 791f1f...546eff )
by Thierry
01:43
created
src/Response/Response.php 3 patches
Doc Comments   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      * @param array         $aAttributes        Associative array of attributes that will describe the command
160 160
      * @param mixed            $mData                The data to be associated with this command
161 161
      *
162
-     * @return \Jaxon\Plugin\Response
162
+     * @return Response
163 163
      */
164 164
     public function addCommand($aAttributes, $mData)
165 165
     {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     /**
201 201
      * Clear all the commands already added to the response
202 202
      *
203
-     * @return \Jaxon\Plugin\Response
203
+     * @return Response
204 204
      */
205 205
     public function clearCommands()
206 206
     {
@@ -214,9 +214,9 @@  discard block
 block discarded – undo
214 214
      *
215 215
      * @param \Jaxon\Plugin\Plugin  $xPlugin            The plugin object
216 216
      * @param array                 $aAttributes        The attributes for this response command
217
-     * @param mixed                 $mData              The data to be sent with this command
217
+     * @param string                 $mData              The data to be sent with this command
218 218
      *
219
-     * @return \Jaxon\Plugin\Response
219
+     * @return Response
220 220
      */
221 221
     public function addPluginCommand($xPlugin, $aAttributes, $mData)
222 222
     {
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      * @param integer        $iCmdNumber            The number of commands to skip upon cancel
278 278
      * @param string        $sMessage            The message to display to the user
279 279
      *
280
-     * @return \Jaxon\Plugin\Response
280
+     * @return Response
281 281
      */
282 282
     public function confirmCommands($iCmdNumber, $sMessage)
283 283
     {
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
      * @param string        $sAttribute           The attribute to be assigned
298 298
      * @param string        $sData                The value to be assigned to the attribute
299 299
      *
300
-     * @return \Jaxon\Plugin\Response
300
+     * @return Response
301 301
      */
302 302
     public function assign($sTarget, $sAttribute, $sData)
303 303
     {
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      * @param string        $sTarget              The id of the html element on the browser
320 320
      * @param string        $sData                The value to be assigned to the attribute
321 321
      *
322
-     * @return \Jaxon\Plugin\Response
322
+     * @return Response
323 323
      */
324 324
     public function html($sTarget, $sData)
325 325
     {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * @param string        $sAttribute            The name of the attribute to be appended to
334 334
      * @param string        $sData                The data to be appended to the attribute
335 335
      *
336
-     * @return \Jaxon\Plugin\Response
336
+     * @return Response
337 337
      */
338 338
     public function append($sTarget, $sAttribute, $sData)
339 339
     {
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      * @param string        $sAttribute            The name of the attribute to be prepended to
355 355
      * @param string        $sData                The value to be prepended to the attribute
356 356
      *
357
-     * @return \Jaxon\Plugin\Response
357
+     * @return Response
358 358
      */
359 359
     public function prepend($sTarget, $sAttribute, $sData)
360 360
     {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      * @param string        $sSearch            The needle to search for
377 377
      * @param string        $sData                The data to use in place of the needle
378 378
      *
379
-     * @return \Jaxon\Plugin\Response
379
+     * @return Response
380 380
      */
381 381
     public function replace($sTarget, $sAttribute, $sSearch, $sData)
382 382
     {
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
      * @param string        $sTarget            The id of the element to be updated.
400 400
      * @param string        $sAttribute            The attribute to be cleared
401 401
      *
402
-     * @return \Jaxon\Plugin\Response
402
+     * @return Response
403 403
      */
404 404
     public function clear($sTarget, $sAttribute)
405 405
     {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
      * @param string        $sAttribute            The attribute to be updated
416 416
      * @param string        $sData                The value to assign
417 417
      *
418
-     * @return \Jaxon\Plugin\Response
418
+     * @return Response
419 419
      */
420 420
     public function contextAssign($sAttribute, $sData)
421 421
     {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
      * @param string        $sAttribute            The attribute to be appended to
438 438
      * @param string        $sData                The value to append
439 439
      *
440
-     * @return \Jaxon\Plugin\Response
440
+     * @return Response
441 441
      */
442 442
     public function contextAppend($sAttribute, $sData)
443 443
     {
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
      * @param string        $sAttribute            The attribute to be updated
460 460
      * @param string        $sData                The value to be prepended
461 461
      *
462
-     * @return \Jaxon\Plugin\Response
462
+     * @return Response
463 463
      */
464 464
     public function contextPrepend($sAttribute, $sData)
465 465
     {
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
      *
481 481
      * @param string        $sAttribute            The attribute to be cleared
482 482
      *
483
-     * @return \Jaxon\Plugin\Response
483
+     * @return Response
484 484
      */
485 485
     public function contextClear($sAttribute)
486 486
     {
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
      *
493 493
      * @param string        $sMessage            The message to be displayed
494 494
      *
495
-     * @return \Jaxon\Plugin\Response
495
+     * @return Response
496 496
      */
497 497
     public function alert($sMessage)
498 498
     {
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
      *
510 510
      * @param string        $sMessage            The message to be displayed
511 511
      *
512
-     * @return \Jaxon\Plugin\Response
512
+     * @return Response
513 513
      */
514 514
     public function debug($sMessage)
515 515
     {
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
      * @param string        $sURL                The relative or fully qualified URL
528 528
      * @param integer        $iDelay                Number of seconds to delay before the redirect occurs
529 529
      *
530
-     * @return \Jaxon\Plugin\Response
530
+     * @return Response
531 531
      */
532 532
     public function redirect($sURL, $iDelay=0)
533 533
     {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
      *
581 581
      * @param string        $sJS                The script to execute
582 582
      *
583
-     * @return \Jaxon\Plugin\Response
583
+     * @return Response
584 584
      */
585 585
     public function script($sJS)
586 586
     {
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
      *
598 598
      * @param string        $sFunc                The name of the function to call
599 599
      *
600
-     * @return \Jaxon\Plugin\Response
600
+     * @return Response
601 601
      */
602 602
     public function call($sFunc)
603 603
     {
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
      *
618 618
      * @param string        $sTarget            The id of the element to be removed
619 619
      *
620
-     * @return \Jaxon\Plugin\Response
620
+     * @return Response
621 621
      */
622 622
     public function remove($sTarget)
623 623
     {
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
      * @param string        $sTag                The tag name to be used for the new element
638 638
      * @param string        $sId                The id to assign to the new element
639 639
      *
640
-     * @return \Jaxon\Plugin\Response
640
+     * @return Response
641 641
      */
642 642
     public function create($sParent, $sTag, $sId)
643 643
     {
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
      * @param string        $sTag               The tag name to be used for the new element
659 659
      * @param string        $sId                The id to assign to the new element
660 660
      *
661
-     * @return \Jaxon\Plugin\Response
661
+     * @return Response
662 662
      */
663 663
     public function insert($sBefore, $sTag, $sId)
664 664
     {
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
      * @param string        $sTag               The tag name to be used for the new element
680 680
      * @param string        $sId                The id to assign to the new element
681 681
      *
682
-     * @return \Jaxon\Plugin\Response
682
+     * @return Response
683 683
      */
684 684
     public function insertAfter($sAfter, $sTag, $sId)
685 685
     {
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
      * @param string        $sName                The name of the new input element
702 702
      * @param string        $sId                The id of the new element
703 703
      *
704
-     * @return \Jaxon\Plugin\Response
704
+     * @return Response
705 705
      */
706 706
     public function createInput($sParent, $sType, $sName, $sId)
707 707
     {
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
      * @param string        $sName                The name of the new input element
725 725
      * @param string        $sId                The id of the new element
726 726
      *
727
-     * @return \Jaxon\Plugin\Response
727
+     * @return Response
728 728
      */
729 729
     public function insertInput($sBefore, $sType, $sName, $sId)
730 730
     {
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
      * @param string        $sName                The name of the new input element
748 748
      * @param string        $sId                The id of the new element
749 749
      *
750
-     * @return \Jaxon\Plugin\Response
750
+     * @return Response
751 751
      */
752 752
     public function insertInputAfter($sAfter, $sType, $sName, $sId)
753 753
     {
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
      * @param string        $sEvent                The name of the event
770 770
      * @param string        $sScript            The javascript to execute when the event is fired
771 771
      *
772
-     * @return \Jaxon\Plugin\Response
772
+     * @return Response
773 773
      */
774 774
     public function setEvent($sTarget, $sEvent, $sScript)
775 775
     {
@@ -789,7 +789,7 @@  discard block
 block discarded – undo
789 789
      * @param string        $sTarget            The id of the element that contains the event
790 790
      * @param string        $sScript            The javascript to execute when the event is fired
791 791
      *
792
-     * @return \Jaxon\Plugin\Response
792
+     * @return Response
793 793
      */
794 794
     public function onClick($sTarget, $sScript)
795 795
     {
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
      * @param string        $sEvent              The name of the event
806 806
      * @param string        $sHandler            The name of the javascript function to call when the event is fired
807 807
      *
808
-     * @return \Jaxon\Plugin\Response
808
+     * @return Response
809 809
      */
810 810
     public function addHandler($sTarget, $sEvent, $sHandler)
811 811
     {
@@ -826,7 +826,7 @@  discard block
 block discarded – undo
826 826
      * @param string        $sEvent              The name of the event
827 827
      * @param string        $sHandler            The name of the javascript function called when the event is fired
828 828
      *
829
-     * @return \Jaxon\Plugin\Response
829
+     * @return Response
830 830
      */
831 831
     public function removeHandler($sTarget, $sEvent, $sHandler)
832 832
     {
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
      * @param string        $sArgs                Comma separated list of parameter names
848 848
      * @param string        $sScript            The javascript code that will become the body of the function
849 849
      *
850
-     * @return \Jaxon\Plugin\Response
850
+     * @return Response
851 851
      */
852 852
     public function setFunction($sFunction, $sArgs, $sScript)
853 853
     {
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
      * @param string        $sReturnValueVar    The name of the variable that will retain the return value
875 875
      *                                             from the call to the original function
876 876
      *
877
-     * @return \Jaxon\Plugin\Response
877
+     * @return Response
878 878
      */
879 879
     public function wrapFunction($sFunction, $sArgs, $aScripts, $sReturnValueVar)
880 880
     {
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
896 896
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
897 897
      *
898
-     * @return \Jaxon\Plugin\Response
898
+     * @return Response
899 899
      */
900 900
     public function includeScript($sFileName, $sType = null, $sId = null)
901 901
     {
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
917 917
      * @param string        $sType                Determines the script type. Defaults to 'text/javascript'
918 918
      *
919
-     * @return \Jaxon\Plugin\Response
919
+     * @return Response
920 920
      */
921 921
     public function includeScriptOnce($sFileName, $sType = null, $sId = null)
922 922
     {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
      * @param string        $sFileName            The relative or fully qualified URI of the javascript file
940 940
      * @param string        $sUnload            Name of a javascript function to call prior to unlaoding the file
941 941
      *
942
-     * @return \Jaxon\Plugin\Response
942
+     * @return Response
943 943
      */
944 944
     public function removeScript($sFileName, $sUnload = '')
945 945
     {
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
      * @param string        $sFileName            The relative or fully qualified URI of the css file
961 961
      * @param string        $sMedia                The media type of the CSS file. Defaults to 'screen'
962 962
      *
963
-     * @return \Jaxon\Plugin\Response
963
+     * @return Response
964 964
      */
965 965
     public function includeCSS($sFileName, $sMedia = null)
966 966
     {
@@ -979,7 +979,7 @@  discard block
 block discarded – undo
979 979
      *
980 980
      * @param string        $sFileName            The relative or fully qualified URI of the css file
981 981
      *
982
-     * @return \Jaxon\Plugin\Response
982
+     * @return Response
983 983
      */
984 984
     public function removeCSS($sFileName, $sMedia = null)
985 985
     {
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
      * @param integer        $iTimeout            The number of 1/10ths of a second to pause before timing out
1005 1005
      *                                             and continuing with the execution of the response commands
1006 1006
      *
1007
-     * @return \Jaxon\Plugin\Response
1007
+     * @return Response
1008 1008
      */
1009 1009
     public function waitForCSS($iTimeout = 600)
1010 1010
     {
@@ -1029,7 +1029,7 @@  discard block
 block discarded – undo
1029 1029
      * @param integer        $tenths                The number of 1/10ths of a second to wait before timing out
1030 1030
      *                                             and continuing with the execution of the response commands.
1031 1031
      *
1032
-     * @return \Jaxon\Plugin\Response
1032
+     * @return Response
1033 1033
      */
1034 1034
     public function waitFor($script, $tenths)
1035 1035
     {
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
      *
1051 1051
      * @param integer        $tenths                The number of 1/10ths of a second to sleep
1052 1052
      *
1053
-     * @return \Jaxon\Plugin\Response
1053
+     * @return Response
1054 1054
      */
1055 1055
     public function sleep($tenths)
1056 1056
     {
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
      * @param string        $variable            The DOM element name (id or class)
1080 1080
      * @param string        $tag                The HTML tag of the new DOM element
1081 1081
      *
1082
-     * @return \Jaxon\Plugin\Response
1082
+     * @return Response
1083 1083
      */
1084 1084
     public function domCreateElement($variable, $tag)
1085 1085
     {
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
      * @param string        $key                The name of the attribute
1100 1100
      * @param string        $value                The value of the attribute
1101 1101
      *
1102
-     * @return \Jaxon\Plugin\Response
1102
+     * @return Response
1103 1103
      */
1104 1104
     public function domSetAttribute($variable, $key, $value)
1105 1105
     {
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
      * @param string        $skip                The ??
1121 1121
      * @param string        $remove                The ??
1122 1122
      *
1123
-     * @return \Jaxon\Plugin\Response
1123
+     * @return Response
1124 1124
      */
1125 1125
     public function domRemoveChildren($parent, $skip = null, $remove = null)
1126 1126
     {
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
      * @param string        $parent                The DOM parent element
1142 1142
      * @param string        $variable            The DOM element name (id or class)
1143 1143
      *
1144
-     * @return \Jaxon\Plugin\Response
1144
+     * @return Response
1145 1145
      */
1146 1146
     public function domAppendChild($parent, $variable)
1147 1147
     {
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
      * @param string        $target                The DOM target element
1161 1161
      * @param string        $variable            The DOM element name (id or class)
1162 1162
      *
1163
-     * @return \Jaxon\Plugin\Response
1163
+     * @return Response
1164 1164
      */
1165 1165
     public function domInsertBefore($target, $variable)
1166 1166
     {
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
      * @param string        $target                The DOM target element
1180 1180
      * @param string        $variable            The DOM element name (id or class)
1181 1181
      *
1182
-     * @return \Jaxon\Plugin\Response
1182
+     * @return Response
1183 1183
      */
1184 1184
     public function domInsertAfter($target, $variable)
1185 1185
     {
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
      * @param string        $parent                The DOM parent element
1199 1199
      * @param string        $text                The HTML text to append
1200 1200
      *
1201
-     * @return \Jaxon\Plugin\Response
1201
+     * @return Response
1202 1202
      */
1203 1203
     public function domAppendText($parent, $text)
1204 1204
     {
@@ -1239,7 +1239,7 @@  discard block
 block discarded – undo
1239 1239
      *
1240 1240
      * @param mixed        $value                Any value
1241 1241
      *
1242
-     * @return \Jaxon\Plugin\Response
1242
+     * @return Response
1243 1243
      */
1244 1244
     public function setReturnValue($value)
1245 1245
     {
Please login to merge, or discard this patch.
Braces   +44 added lines, -40 removed lines patch added patch discarded remove patch
@@ -174,20 +174,17 @@  discard block
 block discarded – undo
174 174
                             $aLastCommand['cmd'] == 'js')
175 175
                     {
176 176
                         $mData = $aLastCommand['data'].'; '.$mData;
177
-                    }
178
-                    elseif($this->getOption('core.response.merge.ap') &&
177
+                    } elseif($this->getOption('core.response.merge.ap') &&
179 178
                             $aLastCommand['cmd'] == 'ap' &&
180 179
                             $aLastCommand['id'] == $aAttributes['id'] &&
181 180
                             $aLastCommand['prop'] == $aAttributes['prop'])
182 181
                     {
183 182
                         $mData = $aLastCommand['data'].' '.$mData;
184
-                    }
185
-                    else
183
+                    } else
186 184
                     {
187 185
                         $this->aCommands[] = $aLastCommand;
188 186
                     }
189
-                }
190
-                else
187
+                } else
191 188
                 {
192 189
                     $this->aCommands[] = $aLastCommand;
193 190
                 }
@@ -244,24 +241,20 @@  discard block
 block discarded – undo
244 241
             if($bBefore)
245 242
             {
246 243
                 $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands);
247
-            }
248
-            else
244
+            } else
249 245
             {
250 246
                 $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands);
251 247
             }
252
-        }
253
-        elseif(is_array($mCommands))
248
+        } elseif(is_array($mCommands))
254 249
         {
255 250
             if($bBefore)
256 251
             {
257 252
                 $this->aCommands = array_merge($mCommands, $this->aCommands);
258
-            }
259
-            else
253
+            } else
260 254
             {
261 255
                 $this->aCommands = array_merge($this->aCommands, $mCommands);
262 256
             }
263
-        }
264
-        else
257
+        } else
265 258
         {
266 259
             if(!empty($mCommands))
267 260
             {
@@ -541,8 +534,9 @@  discard block
 block discarded – undo
541 534
         {
542 535
             $queryStart++;
543 536
             $queryEnd = strpos($sURL, '#', $queryStart);
544
-            if($queryEnd === false)
545
-                $queryEnd = strlen($sURL);
537
+            if($queryEnd === false) {
538
+                            $queryEnd = strlen($sURL);
539
+            }
546 540
             $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
547 541
             parse_str($queryPart, $queryParts);
548 542
             $newQueryPart = "";
@@ -551,10 +545,11 @@  discard block
 block discarded – undo
551 545
                 $first = true;
552 546
                 foreach($queryParts as $key => $value)
553 547
                 {
554
-                    if($first)
555
-                        $first = false;
556
-                    else
557
-                        $newQueryPart .= '&';
548
+                    if($first) {
549
+                                            $first = false;
550
+                    } else {
551
+                                            $newQueryPart .= '&';
552
+                    }
558 553
                     $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
559 554
                 }
560 555
             } elseif($_SERVER['QUERY_STRING']) {
@@ -565,10 +560,11 @@  discard block
 block discarded – undo
565 560
                 }
566 561
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
567 562
         }
568
-        if($iDelay)
569
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
570
-        else
571
-            $this->script('window.location = "' . $sURL . '";');
563
+        if($iDelay) {
564
+                    $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
565
+        } else {
566
+                    $this->script('window.location = "' . $sURL . '";');
567
+        }
572 568
         return $this;
573 569
     }
574 570
 
@@ -903,11 +899,13 @@  discard block
 block discarded – undo
903 899
     {
904 900
         $command = array('cmd'  =>  'in');
905 901
         
906
-        if(($sType))
907
-            $command['type'] = trim((string)$sType, " \t");
902
+        if(($sType)) {
903
+                    $command['type'] = trim((string)$sType, " \t");
904
+        }
908 905
         
909
-        if(($sId))
910
-            $command['elm_id'] = trim((string)$sId, " \t");
906
+        if(($sId)) {
907
+                    $command['elm_id'] = trim((string)$sId, " \t");
908
+        }
911 909
 
912 910
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
913 911
     }
@@ -924,11 +922,13 @@  discard block
 block discarded – undo
924 922
     {
925 923
         $command = array('cmd' => 'ino');
926 924
         
927
-        if(($sType))
928
-            $command['type'] = trim((string)$sType, " \t");
925
+        if(($sType)) {
926
+                    $command['type'] = trim((string)$sType, " \t");
927
+        }
929 928
         
930
-        if(($sId))
931
-            $command['elm_id'] = trim((string)$sId, " \t");
929
+        if(($sId)) {
930
+                    $command['elm_id'] = trim((string)$sId, " \t");
931
+        }
932 932
             
933 933
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
934 934
     }
@@ -968,8 +968,9 @@  discard block
 block discarded – undo
968 968
     {
969 969
         $command = array('cmd' => 'css');
970 970
         
971
-        if(($sMedia))
972
-            $command['media'] = trim((string)$sMedia, " \t");
971
+        if(($sMedia)) {
972
+                    $command['media'] = trim((string)$sMedia, " \t");
973
+        }
973 974
         
974 975
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
975 976
     }
@@ -987,8 +988,9 @@  discard block
 block discarded – undo
987 988
     {
988 989
         $command = array('cmd' => 'rcss');
989 990
         
990
-        if(($sMedia))
991
-            $command['media'] = trim((string)$sMedia, " \t");
991
+        if(($sMedia)) {
992
+                    $command['media'] = trim((string)$sMedia, " \t");
993
+        }
992 994
         
993 995
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
994 996
     }
@@ -1128,11 +1130,13 @@  discard block
 block discarded – undo
1128 1130
     {
1129 1131
         $command = array('cmd' => 'DRC');
1130 1132
 
1131
-        if(($skip))
1132
-            $command['skip'] = $skip;
1133
+        if(($skip)) {
1134
+                    $command['skip'] = $skip;
1135
+        }
1133 1136
 
1134
-        if(($remove))
1135
-            $command['remove'] = $remove;
1137
+        if(($remove)) {
1138
+                    $command['remove'] = $remove;
1139
+        }
1136 1140
 
1137 1141
         return $this->addCommand($command, $parent);
1138 1142
     }
Please login to merge, or discard this patch.
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function plugin($sName)
102 102
     {
103 103
         $xPlugin = $this->getPluginManager()->getResponsePlugin($sName);
104
-        if(!$xPlugin)
104
+        if (!$xPlugin)
105 105
         {
106 106
             return null;
107 107
         }
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
     public function addCommand($aAttributes, $mData)
165 165
     {
166 166
         /* merge commands if possible */
167
-        if(in_array($aAttributes['cmd'], array('js', 'ap')))
167
+        if (in_array($aAttributes['cmd'], array('js', 'ap')))
168 168
         {
169
-            if(($aLastCommand = array_pop($this->aCommands)))
169
+            if (($aLastCommand = array_pop($this->aCommands)))
170 170
             {
171
-                if($aLastCommand['cmd'] == $aAttributes['cmd'])
171
+                if ($aLastCommand['cmd'] == $aAttributes['cmd'])
172 172
                 {
173
-                    if($this->getOption('core.response.merge.js') &&
173
+                    if ($this->getOption('core.response.merge.js') &&
174 174
                             $aLastCommand['cmd'] == 'js')
175 175
                     {
176
-                        $mData = $aLastCommand['data'].'; '.$mData;
176
+                        $mData = $aLastCommand['data'] . '; ' . $mData;
177 177
                     }
178
-                    elseif($this->getOption('core.response.merge.ap') &&
178
+                    elseif ($this->getOption('core.response.merge.ap') &&
179 179
                             $aLastCommand['cmd'] == 'ap' &&
180 180
                             $aLastCommand['id'] == $aAttributes['id'] &&
181 181
                             $aLastCommand['prop'] == $aAttributes['prop'])
182 182
                     {
183
-                        $mData = $aLastCommand['data'].' '.$mData;
183
+                        $mData = $aLastCommand['data'] . ' ' . $mData;
184 184
                     }
185 185
                     else
186 186
                     {
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function appendResponse($mCommands, $bBefore = false)
239 239
     {
240
-        if($mCommands instanceof Response)
240
+        if ($mCommands instanceof Response)
241 241
         {
242 242
             $this->returnValue = $mCommands->returnValue;
243 243
 
244
-            if($bBefore)
244
+            if ($bBefore)
245 245
             {
246 246
                 $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands);
247 247
             }
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                 $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands);
251 251
             }
252 252
         }
253
-        elseif(is_array($mCommands))
253
+        elseif (is_array($mCommands))
254 254
         {
255
-            if($bBefore)
255
+            if ($bBefore)
256 256
             {
257 257
                 $this->aCommands = array_merge($mCommands, $this->aCommands);
258 258
             }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         }
264 264
         else
265 265
         {
266
-            if(!empty($mCommands))
266
+            if (!empty($mCommands))
267 267
             {
268 268
                 throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid'));
269 269
             }
@@ -531,33 +531,33 @@  discard block
 block discarded – undo
531 531
      *
532 532
      * @return \Jaxon\Plugin\Response
533 533
      */
534
-    public function redirect($sURL, $iDelay=0)
534
+    public function redirect($sURL, $iDelay = 0)
535 535
     {
536 536
         // we need to parse the query part so that the values are rawurlencode()'ed
537 537
         // can't just use parse_url() cos we could be dealing with a relative URL which
538 538
         // parse_url() can't deal with.
539 539
         $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
540
-        if($queryStart !== false)
540
+        if ($queryStart !== false)
541 541
         {
542 542
             $queryStart++;
543 543
             $queryEnd = strpos($sURL, '#', $queryStart);
544
-            if($queryEnd === false)
544
+            if ($queryEnd === false)
545 545
                 $queryEnd = strlen($sURL);
546
-            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
546
+            $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
547 547
             parse_str($queryPart, $queryParts);
548 548
             $newQueryPart = "";
549
-            if($queryParts)
549
+            if ($queryParts)
550 550
             {
551 551
                 $first = true;
552
-                foreach($queryParts as $key => $value)
552
+                foreach ($queryParts as $key => $value)
553 553
                 {
554
-                    if($first)
554
+                    if ($first)
555 555
                         $first = false;
556 556
                     else
557 557
                         $newQueryPart .= '&';
558
-                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
558
+                    $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value);
559 559
                 }
560
-            } elseif($_SERVER['QUERY_STRING']) {
560
+            } elseif ($_SERVER['QUERY_STRING']) {
561 561
                     //couldn't break up the query, but there's one there
562 562
                     //possibly "http://url/page.html?query1234" type of query?
563 563
                     //just encode it and hope it works
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
                 }
566 566
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
567 567
         }
568
-        if($iDelay)
569
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
568
+        if ($iDelay)
569
+            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');');
570 570
         else
571 571
             $this->script('window.location = "' . $sURL . '";');
572 572
         return $this;
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
     {
904 904
         $command = array('cmd'  =>  'in');
905 905
 
906
-        if(($sType))
906
+        if (($sType))
907 907
             $command['type'] = trim((string)$sType, " \t");
908 908
 
909
-        if(($sId))
909
+        if (($sId))
910 910
             $command['elm_id'] = trim((string)$sId, " \t");
911 911
 
912 912
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
     {
925 925
         $command = array('cmd' => 'ino');
926 926
 
927
-        if(($sType))
927
+        if (($sType))
928 928
             $command['type'] = trim((string)$sType, " \t");
929 929
 
930
-        if(($sId))
930
+        if (($sId))
931 931
             $command['elm_id'] = trim((string)$sId, " \t");
932 932
 
933 933
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
     {
969 969
         $command = array('cmd' => 'css');
970 970
 
971
-        if(($sMedia))
971
+        if (($sMedia))
972 972
             $command['media'] = trim((string)$sMedia, " \t");
973 973
 
974 974
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     {
988 988
         $command = array('cmd' => 'rcss');
989 989
 
990
-        if(($sMedia))
990
+        if (($sMedia))
991 991
             $command['media'] = trim((string)$sMedia, " \t");
992 992
 
993 993
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
     {
1129 1129
         $command = array('cmd' => 'DRC');
1130 1130
 
1131
-        if(($skip))
1131
+        if (($skip))
1132 1132
             $command['skip'] = $skip;
1133 1133
 
1134
-        if(($remove))
1134
+        if (($remove))
1135 1135
             $command['remove'] = $remove;
1136 1136
 
1137 1137
         return $this->addCommand($command, $parent);
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
     public function sendHeaders()
1258 1258
     {
1259 1259
         $xRequestManager = $this->getRequestManager();
1260
-        if($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET)
1260
+        if ($xRequestManager->getRequestMethod() == Jaxon::METHOD_GET)
1261 1261
         {
1262 1262
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1263 1263
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
 
1268 1268
         $sCharacterSet = '';
1269 1269
         $sCharacterEncoding = trim($this->getOption('core.encoding'));
1270
-        if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1270
+        if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1271 1271
         {
1272 1272
             $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
1273 1273
         }
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
     {
1285 1285
         $response = [];
1286 1286
 
1287
-        if(($this->returnValue))
1287
+        if (($this->returnValue))
1288 1288
         {
1289 1289
             $response['jxnrv'] = $this->returnValue;
1290 1290
         }
1291 1291
         $response['jxnobj'] = [];
1292 1292
 
1293
-        foreach($this->aCommands as $xCommand)
1293
+        foreach ($this->aCommands as $xCommand)
1294 1294
         {
1295 1295
             $response['jxnobj'][] = $xCommand;
1296 1296
         }
Please login to merge, or discard this patch.
src/Traits/Config.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param string        $sLibKey            The key of the library options in the file
70 70
      * @param string|null   $sAppKey            The key of the application options in the file
71 71
      *
72
-     * @return array
72
+     * @return null|\Jaxon\Utils\Config\Config
73 73
      */
74 74
     public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
75 75
     {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string        $sLibKey            The key of the library options in the file
84 84
      * @param string|null   $sAppKey            The key of the application options in the file
85 85
      *
86
-     * @return array
86
+     * @return null|\Jaxon\Utils\Config\Config
87 87
      */
88 88
     public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
89 89
     {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param string        $sLibKey            The key of the library options in the file
98 98
      * @param string|null   $sAppKey            The key of the application options in the file
99 99
      *
100
-     * @return array
100
+     * @return \Jaxon\Utils\Config\Config|null
101 101
      */
102 102
     public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
103 103
     {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param string        $sLibKey            The key of the library options in the file
112 112
      * @param string|null   $sAppKey            The key of the application options in the file
113 113
      *
114
-     * @return array
114
+     * @return null|\Jaxon\Utils\Config\Config
115 115
      */
116 116
     public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
117 117
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             'core.prefix.event'                 => 'jaxon_event_',
44 44
             // 'core.request.uri'               => '',
45 45
             'core.request.mode'                 => 'asynchronous',
46
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
46
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
47 47
             'core.response.merge.ap'            => true,
48 48
             'core.response.merge.js'            => true,
49 49
             'core.debug.on'                     => false,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/Traits/Plugin.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * - 1000 thru 8999: User created plugins, typically, these plugins don't care about order
32 32
      * - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list
33 33
      *
34
-     * @param Plugin         $xPlugin               An instance of a plugin
34
+     * @param \Jaxon\Plugin\Plugin         $xPlugin               An instance of a plugin
35 35
      * @param integer        $nPriority             The plugin priority, used to order the plugins
36 36
      *
37 37
      * @return void
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\DI\Container;
23
-
24 22
 trait Plugin
25 23
 {
26 24
     /**
Please login to merge, or discard this patch.
src/Traits/Upload.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
    /**
47 47
      * Check uploaded files validity and move them to the user dir
48 48
      *
49
-     * @return boolean
49
+     * @return null|boolean
50 50
      */
51 51
     public function saveUploadedFiles()
52 52
     {
Please login to merge, or discard this patch.
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -19,11 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\Plugin\Manager as PluginManager;
23
-use Jaxon\Request\Manager as RequestManager;
24
-use Jaxon\Response\Manager as ResponseManager;
25
-
26
-use Jaxon\Utils\URI;
27 22
 use Exception;
28 23
 use Closure;
29 24
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 trait Upload
31 31
 {
32
-   /**
32
+    /**
33 33
      * Check if uploaded files are available
34 34
      *
35 35
      * @return boolean
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         return $xUploadPlugin->canProcessRequest();
44 44
     }
45 45
 
46
-   /**
46
+    /**
47 47
      * Check uploaded files validity and move them to the user dir
48 48
      *
49 49
      * @return boolean
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function hasUploadedFiles()
38 38
     {
39
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
39
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
40 40
         {
41 41
             return false;
42 42
         }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
     {
53 53
         try
54 54
         {
55
-            if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
55
+            if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
56 56
             {
57 57
                 throw new Exception($this->trans('errors.upload.plugin'));
58 58
             }
59
-            elseif(!$xUploadPlugin->canProcessRequest())
59
+            elseif (!$xUploadPlugin->canProcessRequest())
60 60
             {
61 61
                 throw new Exception($this->trans('errors.upload.request'));
62 62
             }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
66 66
             $return = true;
67 67
         }
68
-        catch(Exception $e)
68
+        catch (Exception $e)
69 69
         {
70 70
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
71 71
             $return = false;
72 72
         }
73 73
         // Send the response back to the browser
74 74
         echo '<script>var res = ', $sResponse, '; </script>';
75
-        if(($this->getOption('core.process.exit')))
75
+        if (($this->getOption('core.process.exit')))
76 76
         {
77 77
             exit();
78 78
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getUploadedFiles()
88 88
     {
89
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
89
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
90 90
         {
91 91
             return [];
92 92
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function setUploadFileFilter(Closure $fFileFilter)
104 104
     {
105
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
105
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
106 106
         {
107 107
             return;
108 108
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
             if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
56 56
             {
57 57
                 throw new Exception($this->trans('errors.upload.plugin'));
58
-            }
59
-            elseif(!$xUploadPlugin->canProcessRequest())
58
+            } elseif(!$xUploadPlugin->canProcessRequest())
60 59
             {
61 60
                 throw new Exception($this->trans('errors.upload.request'));
62 61
             }
@@ -64,8 +63,7 @@  discard block
 block discarded – undo
64 63
             $sKey = $xUploadPlugin->saveUploadedFiles();
65 64
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
66 65
             $return = true;
67
-        }
68
-        catch(Exception $e)
66
+        } catch(Exception $e)
69 67
         {
70 68
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
71 69
             $return = false;
Please login to merge, or discard this patch.
src/DI/Container.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -241,7 +241,7 @@
 block discarded – undo
241 241
     /**
242 242
      * Create a new the config manager
243 243
      *
244
-     * @return Jaxon\Utils\Config\Config            The config manager
244
+     * @return \Jaxon\Utils\Config\Config            The config manager
245 245
      */
246 246
     public function newConfig()
247 247
     {
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
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,19 +90,19 @@  discard block
 block discarded – undo
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\Request\Factory();
103 103
         };
104 104
         // Response Manager
105
-        $this->coreContainer['jaxon.core.response_manager'] = function ($c) {
105
+        $this->coreContainer['jaxon.core.response_manager'] = function($c) {
106 106
             return new \Jaxon\Response\Manager();
107 107
         };
108 108
 
@@ -110,35 +110,35 @@  discard block
 block discarded – undo
110 110
          * Services
111 111
          */
112 112
         // Config manager
113
-        $this->coreContainer['jaxon.core.config'] = function ($c) {
113
+        $this->coreContainer['jaxon.core.config'] = function($c) {
114 114
             return new \Jaxon\Utils\Config\Config();
115 115
         };
116 116
         // Minifier
117
-        $this->coreContainer['jaxon.core.minifier'] = function ($c) {
117
+        $this->coreContainer['jaxon.core.minifier'] = function($c) {
118 118
             return new \Jaxon\Utils\Template\Minifier();
119 119
         };
120 120
         // Translator
121
-        $this->coreContainer['jaxon.core.translator'] = function ($c) {
121
+        $this->coreContainer['jaxon.core.translator'] = function($c) {
122 122
             return new \Jaxon\Utils\Translation\Translator($c['jaxon.core.translation_dir'], $c['jaxon.core.config']);
123 123
         };
124 124
         // Template engine
125
-        $this->coreContainer['jaxon.core.template'] = function ($c) {
125
+        $this->coreContainer['jaxon.core.template'] = function($c) {
126 126
             return new \Jaxon\Utils\Template\Template($c['jaxon.core.template_dir']);
127 127
         };
128 128
         // Validator
129
-        $this->coreContainer['jaxon.core.validator'] = function ($c) {
129
+        $this->coreContainer['jaxon.core.validator'] = function($c) {
130 130
             return new \Jaxon\Utils\Validation\Validator($c['jaxon.core.translator'], $c['jaxon.core.config']);
131 131
         };
132 132
         // Pagination Renderer
133
-        $this->coreContainer['jaxon.pagination.renderer'] = function ($c) {
133
+        $this->coreContainer['jaxon.pagination.renderer'] = function($c) {
134 134
             return new \Jaxon\Utils\Pagination\Renderer();
135 135
         };
136 136
         // Pagination Paginator
137
-        $this->coreContainer['jaxon.pagination.paginator'] = function ($c) {
137
+        $this->coreContainer['jaxon.pagination.paginator'] = function($c) {
138 138
             return new \Jaxon\Utils\Pagination\Paginator($c['jaxon.pagination.renderer']);
139 139
         };
140 140
         // Event Dispatcher
141
-        $this->coreContainer['jaxon.core.events'] = function ($c) {
141
+        $this->coreContainer['jaxon.core.events'] = function($c) {
142 142
             return new EventDispatcher();
143 143
         };
144 144
 
@@ -146,15 +146,15 @@  discard block
 block discarded – undo
146 146
          * Core library objects
147 147
          */
148 148
         // Global Response
149
-        $this->coreContainer['jaxon.core.response'] = function ($c) {
149
+        $this->coreContainer['jaxon.core.response'] = function($c) {
150 150
             return new \Jaxon\Response\Response();
151 151
         };
152 152
         // Jaxon Core
153
-        $this->coreContainer['jaxon.core.jaxon'] = function ($c) {
153
+        $this->coreContainer['jaxon.core.jaxon'] = function($c) {
154 154
             return new \Jaxon\Jaxon();
155 155
         };
156 156
         // View Renderer Facade
157
-        $this->coreContainer['jaxon.sentry.view.renderer'] = function ($c) {
157
+        $this->coreContainer['jaxon.sentry.view.renderer'] = function($c) {
158 158
             $aRenderers = $c['jaxon.view.data.renderers'];
159 159
             $sDefaultNamespace = $c['jaxon.view.data.namespace.default'];
160 160
             return new \Jaxon\Sentry\View\Facade($aRenderers, $sDefaultNamespace);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
      */
169 169
     public function get($sClass)
170 170
     {
171
-        if($this->sentryContainer != null && $this->sentryContainer->has($sClass))
171
+        if ($this->sentryContainer != null && $this->sentryContainer->has($sClass))
172 172
         {
173 173
             return $this->sentryContainer->get($sClass);
174 174
         }
@@ -443,14 +443,14 @@  discard block
 block discarded – undo
443 443
         $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure;
444 444
 
445 445
         // Return the initialized view renderer
446
-        $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) {
446
+        $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) {
447 447
             // Get the defined renderer
448 448
             $renderer = $c['jaxon.sentry.view.base.' . $sId];
449 449
             // Init the renderer with the template namespaces
450 450
             $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces'];
451
-            if(key_exists($sId, $aNamespaces))
451
+            if (key_exists($sId, $aNamespaces))
452 452
             {
453
-                foreach($aNamespaces[$sId] as $ns)
453
+                foreach ($aNamespaces[$sId] as $ns)
454 454
                 {
455 455
                     $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']);
456 456
                 }
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
      */
469 469
     public function getViewRenderer($sId = '')
470 470
     {
471
-        if(!$sId)
471
+        if (!$sId)
472 472
         {
473 473
             // Return the view renderer facade
474 474
             return $this->coreContainer['jaxon.sentry.view.renderer'];
Please login to merge, or discard this patch.
src/Jaxon.php 4 patches
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -25,14 +25,9 @@
 block discarded – undo
25 25
 
26 26
 namespace Jaxon;
27 27
 
28
-use Jaxon\Plugin\Manager as PluginManager;
29
-use Jaxon\Request\Manager as RequestManager;
30
-use Jaxon\Response\Manager as ResponseManager;
31
-
32 28
 use Jaxon\Utils\URI;
33 29
 use Jaxon\DI\Container;
34 30
 use Exception;
35
-use Closure;
36 31
 
37 32
 class Jaxon
38 33
 {
Please login to merge, or discard this patch.
Doc Comments   -8 removed lines patch added patch discarded remove patch
@@ -135,14 +135,6 @@
 block discarded – undo
135 135
      *        Options include:
136 136
      *        - Jaxon::USER_FUNCTION: a function declared at global scope
137 137
      *        - Jaxon::CALLABLE_OBJECT: an object who's methods are to be registered
138
-     * @param mixed        $sFunction | $objObject
139
-     *        When registering a function, this is the name of the function
140
-     *        When registering a callable object, this is the object being registered
141
-     * @param mixed        $sIncludeFile | $aCallOptions
142
-     *        When registering a function, this is an (optional) array
143
-     *             of call options, or the (optional) include file
144
-     *        When registering a callable object, this is an (optional) array
145
-     *             of call options for the functions being registered
146 138
      *
147 139
      * @return mixed
148 140
      */
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -211,16 +211,16 @@  discard block
 block discarded – undo
211 211
      */
212 212
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
213 213
     {
214
-        if(!$this->getOption('core.request.uri'))
214
+        if (!$this->getOption('core.request.uri'))
215 215
         {
216 216
             $this->setOption('core.request.uri', URI::detect());
217 217
         }
218 218
         $sCode = '';
219
-        if(($bIncludeCss))
219
+        if (($bIncludeCss))
220 220
         {
221 221
             $sCode .= $this->getPluginManager()->getCss() . "\n";
222 222
         }
223
-        if(($bIncludeJs))
223
+        if (($bIncludeJs))
224 224
         {
225 225
             $sCode .= $this->getPluginManager()->getJs() . "\n";
226 226
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     public function processRequest()
292 292
     {
293 293
         // Check to see if headers have already been sent out, in which case we can't do our job
294
-        if(headers_sent($filename, $linenumber))
294
+        if (headers_sent($filename, $linenumber))
295 295
         {
296 296
             echo $this->trans('errors.output.already-sent', array(
297 297
                 'location' => $filename . ':' . $linenumber
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
         }
301 301
 
302 302
         // Check if there is a plugin to process this request
303
-        if(!$this->canProcessRequest())
303
+        if (!$this->canProcessRequest())
304 304
         {
305 305
             return;
306 306
         }
@@ -310,18 +310,18 @@  discard block
 block discarded – undo
310 310
         $xResponseManager = $this->getResponseManager();
311 311
 
312 312
         // Handle before processing event
313
-        if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
313
+        if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
314 314
         {
315 315
             $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest));
316 316
         }
317 317
 
318
-        if(!$bEndRequest)
318
+        if (!$bEndRequest)
319 319
         {
320 320
             try
321 321
             {
322 322
                 $mResult = $this->getPluginManager()->processRequest();
323 323
             }
324
-            catch(Exception $e)
324
+            catch (Exception $e)
325 325
             {
326 326
                 // An exception was thrown while processing the request.
327 327
                 // The request missed the corresponding handler function,
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 $xResponseManager->debug($e->getMessage());
334 334
                 $mResult = false;
335 335
 
336
-                if($e instanceof \Jaxon\Exception\Error)
336
+                if ($e instanceof \Jaxon\Exception\Error)
337 337
                 {
338 338
                     $sEvent = self::PROCESSING_EVENT_INVALID;
339 339
                     $aParams = array($e->getMessage());
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                     $aParams = array($e);
345 345
                 }
346 346
 
347
-                if(isset($this->aProcessingEvents[$sEvent]))
347
+                if (isset($this->aProcessingEvents[$sEvent]))
348 348
                 {
349 349
                     // Call the processing event
350 350
                     $this->aProcessingEvents[$sEvent]->call($aParams);
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             }
358 358
         }
359 359
         // Clean the processing buffer
360
-        if(($this->getOption('core.process.clean')))
360
+        if (($this->getOption('core.process.clean')))
361 361
         {
362 362
             $er = error_reporting(0);
363 363
             while (ob_get_level() > 0)
@@ -367,16 +367,16 @@  discard block
 block discarded – undo
367 367
             error_reporting($er);
368 368
         }
369 369
 
370
-        if($mResult === true)
370
+        if ($mResult === true)
371 371
         {
372 372
             // Handle after processing event
373
-            if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
373
+            if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
374 374
             {
375 375
                 $bEndRequest = false;
376 376
                 $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest));
377 377
             }
378 378
             // If the called function returned no response, give the the global response instead
379
-            if($xResponseManager->hasNoResponse())
379
+            if ($xResponseManager->hasNoResponse())
380 380
             {
381 381
                 $xResponseManager->append($this->getResponse());
382 382
             }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
         $xResponseManager->printDebug();
386 386
 
387
-        if(($this->getOption('core.process.exit')))
387
+        if (($this->getOption('core.process.exit')))
388 388
         {
389 389
             $xResponseManager->sendOutput();
390 390
             exit();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -320,8 +320,7 @@  discard block
 block discarded – undo
320 320
             try
321 321
             {
322 322
                 $mResult = $this->getPluginManager()->processRequest();
323
-            }
324
-            catch(Exception $e)
323
+            } catch(Exception $e)
325 324
             {
326 325
                 // An exception was thrown while processing the request.
327 326
                 // The request missed the corresponding handler function,
@@ -337,8 +336,7 @@  discard block
 block discarded – undo
337 336
                 {
338 337
                     $sEvent = self::PROCESSING_EVENT_INVALID;
339 338
                     $aParams = array($e->getMessage());
340
-                }
341
-                else
339
+                } else
342 340
                 {
343 341
                     $sEvent = self::PROCESSING_EVENT_ERROR;
344 342
                     $aParams = array($e);
@@ -348,8 +346,7 @@  discard block
 block discarded – undo
348 346
                 {
349 347
                     // Call the processing event
350 348
                     $this->aProcessingEvents[$sEvent]->call($aParams);
351
-                }
352
-                else
349
+                } else
353 350
                 {
354 351
                     // The exception is not to be processed here.
355 352
                     throw $e;
Please login to merge, or discard this patch.
src/Traits/Autoload.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\DI\Container;
23
-
24 22
 trait Autoload
25 23
 {
26 24
     /**
Please login to merge, or discard this patch.
src/Request/Support/CallableObject.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private function setCallable($xCallable = null)
112 112
     {
113
-        if($xCallable == null)
113
+        if ($xCallable == null)
114 114
         {
115 115
             $di = jaxon()->di();
116 116
             // Use the Reflection class to get the parameters of the constructor
117
-            if(($constructor = $this->reflectionClass->getConstructor()) != null)
117
+            if (($constructor = $this->reflectionClass->getConstructor()) != null)
118 118
             {
119 119
                 $parameters = $constructor->getParameters();
120 120
                 $parameterInstances = [];
121
-                foreach($parameters as $parameter)
121
+                foreach ($parameters as $parameter)
122 122
                 {
123 123
                     // Get the parameter instance from the DI
124 124
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
             }
132 132
         }
133 133
         // Save the Jaxon callable object into the user callable object
134
-        if($this->reflectionClass->hasMethod('setJaxonCallable'))
134
+        if ($this->reflectionClass->hasMethod('setJaxonCallable'))
135 135
         {
136 136
             $xCallable->setJaxonCallable($this);
137 137
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public function getRegisteredObject()
147 147
     {
148
-        if($this->callableObject == null)
148
+        if ($this->callableObject == null)
149 149
         {
150 150
             $this->setCallable();
151 151
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         // The class name without the namespace.
174 174
         $name = $this->reflectionClass->getShortName();
175 175
         // Append the classpath to the name
176
-        if(($this->classpath))
176
+        if (($this->classpath))
177 177
         {
178 178
             $name = $this->classpath . '\\' . $name;
179 179
         }
@@ -220,16 +220,16 @@  discard block
 block discarded – undo
220 220
     public function getMethods()
221 221
     {
222 222
         $aReturn = [];
223
-        foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
223
+        foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
224 224
         {
225 225
             $sMethodName = $xMethod->getShortName();
226 226
             // Don't take magic __call, __construct, __destruct methods
227
-            if(strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
227
+            if (strlen($sMethodName) > 2 && substr($sMethodName, 0, 2) == '__')
228 228
             {
229 229
                 continue;
230 230
             }
231 231
             // Don't take excluded methods
232
-            if(in_array($sMethodName, $this->aProtectedMethods))
232
+            if (in_array($sMethodName, $this->aProtectedMethods))
233 233
             {
234 234
                 continue;
235 235
             }
@@ -250,37 +250,37 @@  discard block
 block discarded – undo
250 250
     public function configure($sMethod, $sName, $sValue)
251 251
     {
252 252
         // Set the namespace
253
-        if($sName == 'namespace')
253
+        if ($sName == 'namespace')
254 254
         {
255
-            if($sValue != '')
255
+            if ($sValue != '')
256 256
                 $this->namespace = $sValue;
257 257
             return;
258 258
         }
259 259
         // Set the classpath
260
-        if($sName == 'classpath')
260
+        if ($sName == 'classpath')
261 261
         {
262
-            if($sValue != '')
262
+            if ($sValue != '')
263 263
                 $this->classpath = trim($sValue, '\\');
264 264
             return;
265 265
         }
266 266
         // Set the separator
267
-        if($sName == 'separator')
267
+        if ($sName == 'separator')
268 268
         {
269
-            if($sValue == '_' || $sValue == '.')
269
+            if ($sValue == '_' || $sValue == '.')
270 270
                 $this->separator = $sValue;
271 271
             return;
272 272
         }
273 273
         // Set the excluded methods
274
-        if($sName == 'protected')
274
+        if ($sName == 'protected')
275 275
         {
276
-            if(is_array($sValue))
276
+            if (is_array($sValue))
277 277
                 $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
278
-            elseif(is_string($sValue))
278
+            elseif (is_string($sValue))
279 279
                 $this->aProtectedMethods[] = $sValue;
280 280
             return;
281 281
         }
282 282
 
283
-        if(!isset($this->aConfiguration[$sMethod]))
283
+        if (!isset($this->aConfiguration[$sMethod]))
284 284
         {
285 285
             $this->aConfiguration[$sMethod] = [];
286 286
         }
@@ -301,16 +301,16 @@  discard block
 block discarded – undo
301 301
 
302 302
         // Common options to be set on all methods
303 303
         $aCommonConfig = array_key_exists('*', $this->aConfiguration) ? $this->aConfiguration['*'] : [];
304
-        foreach($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
304
+        foreach ($this->reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $xMethod)
305 305
         {
306 306
             $sMethodName = $xMethod->getShortName();
307 307
             // Don't export magic __call, __construct, __destruct methods
308
-            if(strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__')
308
+            if (strlen($sMethodName) > 0 && substr($sMethodName, 0, 2) == '__')
309 309
             {
310 310
                 continue;
311 311
             }
312 312
             // Don't export "protected" methods
313
-            if(in_array($sMethodName, $this->aProtectedMethods))
313
+            if (in_array($sMethodName, $this->aProtectedMethods))
314 314
             {
315 315
                 continue;
316 316
             }
@@ -360,14 +360,14 @@  discard block
 block discarded – undo
360 360
      */
361 361
     public function call($sMethod, $aArgs)
362 362
     {
363
-        if(!$this->hasMethod($sMethod))
363
+        if (!$this->hasMethod($sMethod))
364 364
         {
365 365
             return;
366 366
         }
367 367
         $reflectionMethod = $this->reflectionClass->getMethod($sMethod);
368 368
         $callableObject = $this->getRegisteredObject();
369 369
         $response = $reflectionMethod->invokeArgs($callableObject, $aArgs);
370
-        if(($response))
370
+        if (($response))
371 371
         {
372 372
             $this->getResponseManager()->append($response);
373 373
         }
Please login to merge, or discard this patch.
Braces   +15 added lines, -12 removed lines patch added patch discarded remove patch
@@ -124,8 +124,7 @@  discard block
 block discarded – undo
124 124
                     $parameterInstances[] = $di->get($parameter->getClass()->getName());
125 125
                 }
126 126
                 $xCallable = $this->reflectionClass->newInstanceArgs($parameterInstances);
127
-            }
128
-            else
127
+            } else
129 128
             {
130 129
                 $xCallable = $this->reflectionClass->newInstance();
131 130
             }
@@ -252,31 +251,35 @@  discard block
 block discarded – undo
252 251
         // Set the namespace
253 252
         if($sName == 'namespace')
254 253
         {
255
-            if($sValue != '')
256
-                $this->namespace = $sValue;
254
+            if($sValue != '') {
255
+                            $this->namespace = $sValue;
256
+            }
257 257
             return;
258 258
         }
259 259
         // Set the classpath
260 260
         if($sName == 'classpath')
261 261
         {
262
-            if($sValue != '')
263
-                $this->classpath = trim($sValue, '\\');
262
+            if($sValue != '') {
263
+                            $this->classpath = trim($sValue, '\\');
264
+            }
264 265
             return;
265 266
         }
266 267
         // Set the separator
267 268
         if($sName == 'separator')
268 269
         {
269
-            if($sValue == '_' || $sValue == '.')
270
-                $this->separator = $sValue;
270
+            if($sValue == '_' || $sValue == '.') {
271
+                            $this->separator = $sValue;
272
+            }
271 273
             return;
272 274
         }
273 275
         // Set the excluded methods
274 276
         if($sName == 'protected')
275 277
         {
276
-            if(is_array($sValue))
277
-                $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
278
-            elseif(is_string($sValue))
279
-                $this->aProtectedMethods[] = $sValue;
278
+            if(is_array($sValue)) {
279
+                            $this->aProtectedMethods = array_merge($this->aProtectedMethods, $sValue);
280
+            } elseif(is_string($sValue)) {
281
+                            $this->aProtectedMethods[] = $sValue;
282
+            }
280 283
             return;
281 284
         }
282 285
 
Please login to merge, or discard this patch.
src/Request/Support/UserFunction.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 = [$sValue, $this->sUserFunction];
@@ -151,12 +151,12 @@  discard block
 block discarded – undo
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
         }
Please login to merge, or discard this patch.