Completed
Push — master ( c61dd9...791f1f )
by Thierry
01:36
created
src/Response/Manager.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function append(Response $xResponse)
73 73
     {
74
-        if(!$this->xResponse)
74
+        if (!$this->xResponse)
75 75
         {
76 76
             $this->xResponse = $xResponse;
77 77
         }
78
-        elseif(get_class($this->xResponse) == get_class($xResponse))
78
+        elseif (get_class($this->xResponse) == get_class($xResponse))
79 79
         {
80
-            if($this->xResponse != $xResponse)
80
+            if ($this->xResponse != $xResponse)
81 81
             {
82 82
                 $this->xResponse->appendResponse($xResponse);
83 83
             }
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
      */
111 111
     public function printDebug()
112 112
     {
113
-        if(($this->xResponse))
113
+        if (($this->xResponse))
114 114
         {
115
-            foreach($this->aDebugMessages as $sMessage)
115
+            foreach ($this->aDebugMessages as $sMessage)
116 116
             {
117 117
                 $this->xResponse->debug($sMessage);
118 118
             }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      */
128 128
     public function sendHeaders()
129 129
     {
130
-        if(($this->xResponse))
130
+        if (($this->xResponse))
131 131
         {
132 132
             $this->xResponse->sendHeaders();
133 133
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
      */
141 141
     public function getOutput()
142 142
     {
143
-        if(($this->xResponse))
143
+        if (($this->xResponse))
144 144
         {
145 145
             return $this->xResponse->getOutput();
146 146
         }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
      */
155 155
     public function sendOutput()
156 156
     {
157
-        if(($this->xResponse))
157
+        if (($this->xResponse))
158 158
         {
159 159
             $this->xResponse->sendHeaders();
160 160
             $this->xResponse->printOutput();
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -74,15 +74,13 @@
 block discarded – undo
74 74
         if(!$this->xResponse)
75 75
         {
76 76
             $this->xResponse = $xResponse;
77
-        }
78
-        elseif(get_class($this->xResponse) == get_class($xResponse))
77
+        } elseif(get_class($this->xResponse) == get_class($xResponse))
79 78
         {
80 79
             if($this->xResponse != $xResponse)
81 80
             {
82 81
                 $this->xResponse->appendResponse($xResponse);
83 82
             }
84
-        }
85
-        else
83
+        } else
86 84
         {
87 85
             $this->debug($this->trans('errors.mismatch.types', array('class' => get_class($xResponse))));
88 86
         }
Please login to merge, or discard this patch.
src/Utils/URI.php 2 patches
Braces   +10 added lines, -16 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
             if(!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40
-            }
41
-            else
40
+            } else
42 41
             {
43 42
                 $aURL['scheme'] = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http');
44 43
             }
@@ -51,28 +50,23 @@  discard block
 block discarded – undo
51 50
                 if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 51
                 {
53 52
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54
-                }
55
-                else
53
+                } else
56 54
                 {
57 55
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 56
                 }
59
-            }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
57
+            } elseif(!empty($_SERVER['HTTP_HOST']))
61 58
             {
62 59
                 if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 60
                 {
64 61
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65
-                }
66
-                else
62
+                } else
67 63
                 {
68 64
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 65
                 }
70
-            }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
66
+            } elseif(!empty($_SERVER['SERVER_NAME']))
72 67
             {
73 68
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74
-            }
75
-            else
69
+            } else
76 70
             {
77 71
                 throw new \Jaxon\Exception\URI();
78 72
             }
@@ -94,8 +88,7 @@  discard block
 block discarded – undo
94 88
             if(!empty($_SERVER['PATH_INFO']))
95 89
             {
96 90
                 $sPath = parse_url($_SERVER['PATH_INFO']);
97
-            }
98
-            else
91
+            } else
99 92
             {
100 93
                 $sPath = parse_url($_SERVER['PHP_SELF']);
101 94
             }
@@ -153,8 +146,9 @@  discard block
 block discarded – undo
153 146
         
154 147
             foreach($aQueries as $sKey => $sQuery)
155 148
             {
156
-                if("jxnGenerate" == substr($sQuery, 0, 11))
157
-                    unset($aQueries[$sKey]);
149
+                if("jxnGenerate" == substr($sQuery, 0, 11)) {
150
+                                    unset($aQueries[$sKey]);
151
+                }
158 152
             }
159 153
                 
160 154
             $sQueries = implode("&", $aQueries);
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@  discard block
 block discarded – undo
25 25
     {
26 26
         $aURL = [];
27 27
         // Try to get the request URL
28
-        if(!empty($_SERVER['REQUEST_URI']))
28
+        if (!empty($_SERVER['REQUEST_URI']))
29 29
         {
30
-            $_SERVER['REQUEST_URI'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $_SERVER['REQUEST_URI']);
30
+            $_SERVER['REQUEST_URI'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $_SERVER['REQUEST_URI']);
31 31
             $aURL = parse_url($_SERVER['REQUEST_URI']);
32 32
         }
33 33
 
34 34
         // Fill in the empty values
35
-        if(empty($aURL['scheme']))
35
+        if (empty($aURL['scheme']))
36 36
         {
37
-            if(!empty($_SERVER['HTTP_SCHEME']))
37
+            if (!empty($_SERVER['HTTP_SCHEME']))
38 38
             {
39 39
                 $aURL['scheme'] = $_SERVER['HTTP_SCHEME'];
40 40
             }
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
             }
45 45
         }
46 46
 
47
-        if(empty($aURL['host']))
47
+        if (empty($aURL['host']))
48 48
         {
49
-            if(!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
49
+            if (!empty($_SERVER['HTTP_X_FORWARDED_HOST']))
50 50
             {
51
-                if(strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
51
+                if (strpos($_SERVER['HTTP_X_FORWARDED_HOST'], ':') > 0)
52 52
                 {
53 53
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_X_FORWARDED_HOST']);
54 54
                 }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
                     $aURL['host'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
58 58
                 }
59 59
             }
60
-            elseif(!empty($_SERVER['HTTP_HOST']))
60
+            elseif (!empty($_SERVER['HTTP_HOST']))
61 61
             {
62
-                if(strpos($_SERVER['HTTP_HOST'], ':') > 0)
62
+                if (strpos($_SERVER['HTTP_HOST'], ':') > 0)
63 63
                 {
64 64
                     list($aURL['host'], $aURL['port']) = explode(':', $_SERVER['HTTP_HOST']);
65 65
                 }
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     $aURL['host'] = $_SERVER['HTTP_HOST'];
69 69
                 }
70 70
             }
71
-            elseif(!empty($_SERVER['SERVER_NAME']))
71
+            elseif (!empty($_SERVER['SERVER_NAME']))
72 72
             {
73 73
                 $aURL['host'] = $_SERVER['SERVER_NAME'];
74 74
             }
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
             }
79 79
         }
80 80
 
81
-        if(empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
81
+        if (empty($aURL['port']) && !empty($_SERVER['SERVER_PORT']))
82 82
         {
83 83
             $aURL['port'] = $_SERVER['SERVER_PORT'];
84 84
         }
85 85
 
86
-        if(!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
86
+        if (!empty($aURL['path']) && strlen(basename($aURL['path'])) == 0)
87 87
         {
88 88
             unset($aURL['path']);
89 89
         }
90 90
 
91
-        if(empty($aURL['path']))
91
+        if (empty($aURL['path']))
92 92
         {
93 93
             $sPath = [];
94
-            if(!empty($_SERVER['PATH_INFO']))
94
+            if (!empty($_SERVER['PATH_INFO']))
95 95
             {
96 96
                 $sPath = parse_url($_SERVER['PATH_INFO']);
97 97
             }
@@ -99,61 +99,61 @@  discard block
 block discarded – undo
99 99
             {
100 100
                 $sPath = parse_url($_SERVER['PHP_SELF']);
101 101
             }
102
-            if(isset($sPath['path']))
102
+            if (isset($sPath['path']))
103 103
             {
104
-                $aURL['path'] = str_replace(array('"',"'",'<','>'), array('%22','%27','%3C','%3E'), $sPath['path']);
104
+                $aURL['path'] = str_replace(array('"', "'", '<', '>'), array('%22', '%27', '%3C', '%3E'), $sPath['path']);
105 105
             }
106 106
             unset($sPath);
107 107
         }
108 108
 
109
-        if(empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
109
+        if (empty($aURL['query']) && !empty($_SERVER['QUERY_STRING']))
110 110
         {
111 111
             $aURL['query'] = $_SERVER['QUERY_STRING'];
112 112
         }
113 113
 
114
-        if(!empty($aURL['query']))
114
+        if (!empty($aURL['query']))
115 115
         {
116
-            $aURL['query'] = '?'.$aURL['query'];
116
+            $aURL['query'] = '?' . $aURL['query'];
117 117
         }
118 118
 
119 119
         // Build the URL: Start with scheme, user and pass
120
-        $sURL = $aURL['scheme'].'://';
121
-        if(!empty($aURL['user']))
120
+        $sURL = $aURL['scheme'] . '://';
121
+        if (!empty($aURL['user']))
122 122
         {
123
-            $sURL.= $aURL['user'];
124
-            if(!empty($aURL['pass']))
123
+            $sURL .= $aURL['user'];
124
+            if (!empty($aURL['pass']))
125 125
             {
126
-                $sURL.= ':'.$aURL['pass'];
126
+                $sURL .= ':' . $aURL['pass'];
127 127
             }
128
-            $sURL.= '@';
128
+            $sURL .= '@';
129 129
         }
130 130
 
131 131
         // Add the host
132
-        $sURL.= $aURL['host'];
132
+        $sURL .= $aURL['host'];
133 133
 
134 134
         // Add the port if needed
135
-        if(!empty($aURL['port'])
135
+        if (!empty($aURL['port'])
136 136
                 && (($aURL['scheme'] == 'http' && $aURL['port'] != 80)
137 137
                         || ($aURL['scheme'] == 'https' && $aURL['port'] != 443)))
138 138
         {
139
-            $sURL.= ':'.$aURL['port'];
139
+            $sURL .= ':' . $aURL['port'];
140 140
         }
141 141
 
142 142
         // Add the path and the query string
143
-        $sURL.= $aURL['path'].@$aURL['query'];
143
+        $sURL .= $aURL['path'] . @$aURL['query'];
144 144
 
145 145
         // Clean up
146 146
         unset($aURL);
147 147
 
148 148
         $aURL = explode("?", $sURL);
149 149
 
150
-        if(1 < count($aURL))
150
+        if (1 < count($aURL))
151 151
         {
152 152
             $aQueries = explode("&", $aURL[1]);
153 153
 
154
-            foreach($aQueries as $sKey => $sQuery)
154
+            foreach ($aQueries as $sKey => $sQuery)
155 155
             {
156
-                if("jxnGenerate" == substr($sQuery, 0, 11))
156
+                if ("jxnGenerate" == substr($sQuery, 0, 11))
157 157
                     unset($aQueries[$sKey]);
158 158
             }
159 159
 
Please login to merge, or discard this patch.
src/Utils/Config/Json.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
     public static function read($sConfigFile, $sLibKey = '', $sAppKey = null)
30 30
     {
31 31
         $sConfigFile = realpath($sConfigFile);
32
-        if(!is_readable($sConfigFile))
32
+        if (!is_readable($sConfigFile))
33 33
         {
34 34
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile)));
35 35
         }
36 36
         $sFileContent = file_get_contents($sConfigFile);
37 37
         $aConfigOptions = json_decode($sFileContent, true);
38
-        if(!is_array($aConfigOptions))
38
+        if (!is_array($aConfigOptions))
39 39
         {
40 40
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile)));
41 41
         }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $jaxon = jaxon();
45 45
         $jaxon->setOptions($aConfigOptions, $sLibKey);
46 46
         $config = null;
47
-        if(is_string($sAppKey))
47
+        if (is_string($sAppKey))
48 48
         {
49 49
             $config = new Config();
50 50
             $config->setOptions($aConfigOptions, $sAppKey);
Please login to merge, or discard this patch.
src/Utils/Config/Yaml.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
     public static function read($sConfigFile, $sLibKey = '', $sAppKey = null)
30 30
     {
31 31
         $sConfigFile = realpath($sConfigFile);
32
-        if(!extension_loaded('yaml'))
32
+        if (!extension_loaded('yaml'))
33 33
         {
34 34
             throw new \Jaxon\Exception\Config\Yaml(jaxon_trans('config.errors.yaml.install'));
35 35
         }
36
-        if(!is_readable($sConfigFile))
36
+        if (!is_readable($sConfigFile))
37 37
         {
38 38
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile)));
39 39
         }
40 40
         $aConfigOptions = yaml_parse_file($sConfigFile);
41
-        if(!is_array($aConfigOptions))
41
+        if (!is_array($aConfigOptions))
42 42
         {
43 43
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile)));
44 44
         }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         // Setup the config options into the library.
47 47
         $jaxon = jaxon();
48 48
         $jaxon->setOptions($aConfigOptions, $sLibKey);
49
-        if(!is_string($sAppKey))
49
+        if (!is_string($sAppKey))
50 50
         {
51 51
             return null;
52 52
         }
Please login to merge, or discard this patch.
src/Utils/Config/Php.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
     public static function read($sConfigFile, $sLibKey = '', $sAppKey = null)
30 30
     {
31 31
         $sConfigFile = realpath($sConfigFile);
32
-        if(!is_readable($sConfigFile))
32
+        if (!is_readable($sConfigFile))
33 33
         {
34 34
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.access', array('path' => $sConfigFile)));
35 35
         }
36 36
         $aConfigOptions = include($sConfigFile);
37
-        if(!is_array($aConfigOptions))
37
+        if (!is_array($aConfigOptions))
38 38
         {
39 39
             throw new \Jaxon\Exception\Config\File(jaxon_trans('config.errors.file.content', array('path' => $sConfigFile)));
40 40
         }
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         // Setup the config options into the library.
43 43
         $jaxon = jaxon();
44 44
         $jaxon->setOptions($aConfigOptions, $sLibKey);
45
-        if(!is_string($sAppKey))
45
+        if (!is_string($sAppKey))
46 46
         {
47 47
             return null;
48 48
         }
Please login to merge, or discard this patch.
src/Request/Parameter.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -91,19 +91,19 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public static function make($xValue)
93 93
     {
94
-        if($xValue instanceof Interfaces\Parameter)
94
+        if ($xValue instanceof Interfaces\Parameter)
95 95
         {
96 96
             return $xValue;
97 97
         }
98
-        elseif(is_numeric($xValue))
98
+        elseif (is_numeric($xValue))
99 99
         {
100 100
             return new Parameter(Jaxon::NUMERIC_VALUE, $xValue);
101 101
         }
102
-        elseif(is_string($xValue))
102
+        elseif (is_string($xValue))
103 103
         {
104 104
             return new Parameter(Jaxon::QUOTED_VALUE, $xValue);
105 105
         }
106
-        elseif(is_bool($xValue))
106
+        elseif (is_bool($xValue))
107 107
         {
108 108
             return new Parameter(Jaxon::BOOL_VALUE, $xValue);
109 109
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $sJsCode = '';
124 124
         $sQuoteCharacter = "'";
125
-        switch($this->sType)
125
+        switch ($this->sType)
126 126
         {
127 127
         case Jaxon::FORM_VALUES:
128 128
             $sFormID = (string)$this->xValue;
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
             break;
131 131
         case Jaxon::INPUT_VALUE:
132 132
             $sInputID = (string)$this->xValue;
133
-            $sJsCode = "jaxon.$("  . $sQuoteCharacter . $sInputID . $sQuoteCharacter  . ").value";
133
+            $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sInputID . $sQuoteCharacter . ").value";
134 134
             break;
135 135
         case Jaxon::CHECKED_VALUE:
136 136
             $sCheckedID = (string)$this->xValue;
137
-            $sJsCode = "jaxon.$("  . $sQuoteCharacter . $sCheckedID  . $sQuoteCharacter . ").checked";
137
+            $sJsCode = "jaxon.$(" . $sQuoteCharacter . $sCheckedID . $sQuoteCharacter . ").checked";
138 138
             break;
139 139
         case Jaxon::ELEMENT_INNERHTML:
140 140
             $sElementID = (string)$this->xValue;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $sJsCode = (string)$this->xValue;
154 154
             break;
155 155
         case Jaxon::JS_VALUE:
156
-            if(is_array($this->xValue) || is_object($this->xValue))
156
+            if (is_array($this->xValue) || is_object($this->xValue))
157 157
             {
158 158
                 // Unable to use double quotes here because they cannot be handled on client side.
159 159
                 // So we are using simple quotes even if the Json standard recommends double quotes.
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -94,20 +94,16 @@  discard block
 block discarded – undo
94 94
         if($xValue instanceof Interfaces\Parameter)
95 95
         {
96 96
             return $xValue;
97
-        }
98
-        elseif(is_numeric($xValue))
97
+        } elseif(is_numeric($xValue))
99 98
         {
100 99
             return new Parameter(Jaxon::NUMERIC_VALUE, $xValue);
101
-        }
102
-        elseif(is_string($xValue))
100
+        } elseif(is_string($xValue))
103 101
         {
104 102
             return new Parameter(Jaxon::QUOTED_VALUE, $xValue);
105
-        }
106
-        elseif(is_bool($xValue))
103
+        } elseif(is_bool($xValue))
107 104
         {
108 105
             return new Parameter(Jaxon::BOOL_VALUE, $xValue);
109
-        }
110
-        else // if(is_array($xValue) || is_object($xValue))
106
+        } else // if(is_array($xValue) || is_object($xValue))
111 107
         {
112 108
             return new Parameter(Jaxon::JS_VALUE, $xValue);
113 109
         }
@@ -158,8 +154,7 @@  discard block
 block discarded – undo
158 154
                 // Unable to use double quotes here because they cannot be handled on client side.
159 155
                 // So we are using simple quotes even if the Json standard recommends double quotes.
160 156
                 $sJsCode = str_replace(['"'], ["'"], json_encode($this->xValue, JSON_HEX_APOS | JSON_HEX_QUOT));
161
-            }
162
-            else
157
+            } else
163 158
             {
164 159
                 $sJsCode = (string)$this->xValue;
165 160
             }
Please login to merge, or discard this patch.
src/Plugin/Manager.php 3 patches
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.
Unused Use Statements   -3 removed lines patch added patch discarded remove patch
@@ -22,11 +22,8 @@
 block discarded – undo
22 22
 namespace Jaxon\Plugin;
23 23
 
24 24
 use Jaxon\Jaxon;
25
-use Jaxon\Plugin\Package;
26 25
 use RecursiveDirectoryIterator;
27 26
 use RecursiveIteratorIterator;
28
-use RegexIterator;
29
-use RecursiveRegexIterator;
30 27
 use Closure;
31 28
 
32 29
 class Manager
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -267,32 +267,32 @@  discard block
 block discarded – undo
267 267
     {
268 268
         $bIsAlert = ($xPlugin instanceof \Jaxon\Request\Interfaces\Alert);
269 269
         $bIsConfirm = ($xPlugin instanceof \Jaxon\Request\Interfaces\Confirm);
270
-        if($xPlugin instanceof Request)
270
+        if ($xPlugin instanceof Request)
271 271
         {
272 272
             // The name of a request plugin is used as key in the plugin table
273 273
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
274 274
         }
275
-        elseif($xPlugin instanceof Response)
275
+        elseif ($xPlugin instanceof Response)
276 276
         {
277 277
             // The name of a response plugin is used as key in the plugin table
278 278
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
279 279
         }
280
-        elseif(!$bIsConfirm && !$bIsAlert)
280
+        elseif (!$bIsConfirm && !$bIsAlert)
281 281
         {
282 282
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin))));
283 283
         }
284 284
         // This plugin implements the Alert interface
285
-        if($bIsAlert)
285
+        if ($bIsAlert)
286 286
         {
287 287
             $this->setAlert($xPlugin);
288 288
         }
289 289
         // This plugin implements the Confirm interface
290
-        if($bIsConfirm)
290
+        if ($bIsConfirm)
291 291
         {
292 292
             $this->setConfirm($xPlugin);
293 293
         }
294 294
         // Register the plugin as an event listener
295
-        if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
295
+        if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
296 296
         {
297 297
             $this->addEventListener($xPlugin);
298 298
         }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
     private function generateHash()
323 323
     {
324 324
         $sHash = $this->getVersion();
325
-        foreach($this->aPlugins as $xPlugin)
325
+        foreach ($this->aPlugins as $xPlugin)
326 326
         {
327 327
             $sHash .= $xPlugin->generateHash();
328 328
         }
@@ -339,9 +339,9 @@  discard block
 block discarded – undo
339 339
      */
340 340
     public function canProcessRequest()
341 341
     {
342
-        foreach($this->aRequestPlugins as $xPlugin)
342
+        foreach ($this->aRequestPlugins as $xPlugin)
343 343
         {
344
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
344
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
345 345
             {
346 346
                 return true;
347 347
             }
@@ -360,12 +360,12 @@  discard block
 block discarded – undo
360 360
     public function processRequest()
361 361
     {
362 362
         $xUploadPlugin = $this->getRequestPlugin(Jaxon::FILE_UPLOAD);
363
-        foreach($this->aRequestPlugins as $xPlugin)
363
+        foreach ($this->aRequestPlugins as $xPlugin)
364 364
         {
365
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
365
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
366 366
             {
367 367
                 // Process uploaded files
368
-                if($xUploadPlugin != null)
368
+                if ($xUploadPlugin != null)
369 369
                 {
370 370
                     $xUploadPlugin->processRequest();
371 371
                 }
@@ -389,10 +389,10 @@  discard block
 block discarded – undo
389 389
      */
390 390
     public function register($aArgs)
391 391
     {
392
-        foreach($this->aRequestPlugins as $xPlugin)
392
+        foreach ($this->aRequestPlugins as $xPlugin)
393 393
         {
394 394
             $mResult = $xPlugin->register($aArgs);
395
-            if($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true)
395
+            if ($mResult instanceof \Jaxon\Request\Request || is_array($mResult) || $mResult === true)
396 396
             {
397 397
                 return $mResult;
398 398
             }
@@ -412,37 +412,37 @@  discard block
 block discarded – undo
412 412
      */
413 413
     public function addClassDir($sDirectory, $sNamespace = '', $sSeparator = '.', array $aProtected = [])
414 414
     {
415
-        if(!is_dir(($sDirectory = trim($sDirectory))))
415
+        if (!is_dir(($sDirectory = trim($sDirectory))))
416 416
         {
417 417
             return false;
418 418
         }
419 419
         // Only '.' and '_' are allowed to be used as separator. Any other value is ignored and '.' is used instead.
420
-        if(($sSeparator = trim($sSeparator)) != '_')
420
+        if (($sSeparator = trim($sSeparator)) != '_')
421 421
         {
422 422
             $sSeparator = '.';
423 423
         }
424
-        if(!($sNamespace = trim($sNamespace, ' \\')))
424
+        if (!($sNamespace = trim($sNamespace, ' \\')))
425 425
         {
426 426
             $sNamespace = '';
427 427
         }
428
-        if(($sNamespace))
428
+        if (($sNamespace))
429 429
         {
430 430
             // If there is an autoloader, register the dir with PSR4 autoloading
431
-            if(($this->xAutoloader))
431
+            if (($this->xAutoloader))
432 432
             {
433 433
                 $this->xAutoloader->setPsr4($sNamespace . '\\', $sDirectory);
434 434
             }
435 435
         }
436
-        elseif(($this->xAutoloader))
436
+        elseif (($this->xAutoloader))
437 437
         {
438 438
             // If there is an autoloader, register the dir with classmap autoloading
439 439
             $itDir = new RecursiveDirectoryIterator($sDirectory);
440 440
             $itFile = new RecursiveIteratorIterator($itDir);
441 441
             // Iterate on dir content
442
-            foreach($itFile as $xFile)
442
+            foreach ($itFile as $xFile)
443 443
             {
444 444
                 // skip everything except PHP files
445
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
445
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
446 446
                 {
447 447
                     continue;
448 448
                 }
@@ -478,33 +478,33 @@  discard block
 block discarded – undo
478 478
         $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
479 479
         $sClassPath = str_replace($sDS, '\\', trim($sClassPath, $sDS));
480 480
         $sClassName = $xFile->getBasename('.php');
481
-        if(($sNamespace))
481
+        if (($sNamespace))
482 482
         {
483 483
             $sClassPath = ($sClassPath) ? $sNamespace . '\\' . $sClassPath : $sNamespace;
484 484
             $sClassName = '\\' . $sClassPath . '\\' . $sClassName;
485 485
         }
486 486
         // Require the file only if autoload is enabled but there is no autoloader
487
-        if(($this->bAutoloadEnabled) && !($this->xAutoloader))
487
+        if (($this->bAutoloadEnabled) && !($this->xAutoloader))
488 488
         {
489 489
             require_once($xFile->getPathname());
490 490
         }
491 491
         // Create and register an instance of the class
492
-        if(!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
492
+        if (!array_key_exists('*', $aOptions) || !is_array($aOptions['*']))
493 493
         {
494 494
             $aOptions['*'] = [];
495 495
         }
496 496
         $aOptions['*']['separator'] = $sSeparator;
497
-        if(($sNamespace))
497
+        if (($sNamespace))
498 498
         {
499 499
             $aOptions['*']['namespace'] = $sNamespace;
500 500
         }
501
-        if(($sClassPath))
501
+        if (($sClassPath))
502 502
         {
503 503
             $aOptions['*']['classpath'] = $sClassPath;
504 504
         }
505 505
         // Filter excluded methods
506
-        $aProtected = array_filter($aProtected, function ($sName) {return is_string($sName);});
507
-        if(count($aProtected) > 0)
506
+        $aProtected = array_filter($aProtected, function($sName) {return is_string($sName); });
507
+        if (count($aProtected) > 0)
508 508
         {
509 509
             $aOptions['*']['protected'] = $aProtected;
510 510
         }
@@ -523,13 +523,13 @@  discard block
 block discarded – undo
523 523
         $sDS = DIRECTORY_SEPARATOR;
524 524
         // Change the keys in $aOptions to have "\" as separator
525 525
         $aNewOptions = [];
526
-        foreach($aOptions as $key => $aOption)
526
+        foreach ($aOptions as $key => $aOption)
527 527
         {
528 528
             $key = trim(str_replace(['.', '_'], ['\\', '\\'], $key), ' \\');
529 529
             $aNewOptions[$key] = $aOption;
530 530
         }
531 531
 
532
-        foreach($this->aClassDirs as $aClassDir)
532
+        foreach ($this->aClassDirs as $aClassDir)
533 533
         {
534 534
             // Get the directory
535 535
             $sDirectory = $aClassDir['directory'];
@@ -539,10 +539,10 @@  discard block
 block discarded – undo
539 539
             $itDir = new RecursiveDirectoryIterator($sDirectory);
540 540
             $itFile = new RecursiveIteratorIterator($itDir);
541 541
             // Iterate on dir content
542
-            foreach($itFile as $xFile)
542
+            foreach ($itFile as $xFile)
543 543
             {
544 544
                 // skip everything except PHP files
545
-                if(!$xFile->isFile() || $xFile->getExtension() != 'php')
545
+                if (!$xFile->isFile() || $xFile->getExtension() != 'php')
546 546
                 {
547 547
                     continue;
548 548
                 }
@@ -551,17 +551,17 @@  discard block
 block discarded – undo
551 551
                 $sClassPath = substr($xFile->getPath(), strlen($sDirectory));
552 552
                 $sClassPath = trim(str_replace($sDS, '\\', $sClassPath), '\\');
553 553
                 $sClassName = $xFile->getBasename('.php');
554
-                if(($sClassPath))
554
+                if (($sClassPath))
555 555
                 {
556 556
                     $sClassName = $sClassPath . '\\' . $sClassName;
557 557
                 }
558
-                if(($sNamespace))
558
+                if (($sNamespace))
559 559
                 {
560 560
                     $sClassName = $sNamespace . '\\' . $sClassName;
561 561
                 }
562 562
                 // Get the class options
563 563
                 $aClassOptions = [];
564
-                if(array_key_exists($sClassName, $aNewOptions))
564
+                if (array_key_exists($sClassName, $aNewOptions))
565 565
                 {
566 566
                     $aClassOptions = $aNewOptions[$sClassName];
567 567
                 }
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
      */
583 583
     public function registerClass($sClassName, array $aOptions = [])
584 584
     {
585
-        if(!($sClassName = trim($sClassName, ' \\._')))
585
+        if (!($sClassName = trim($sClassName, ' \\._')))
586 586
         {
587 587
             return false;
588 588
         }
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         // Replace "." and "_" with antislashes, and set the class path.
592 592
         $sClassName = str_replace(['.', '_'], ['\\', '\\'], $sClassName);
593 593
         $sClassPath = '';
594
-        if(($nLastSlashPosition = strrpos($sClassName, '\\')) !== false)
594
+        if (($nLastSlashPosition = strrpos($sClassName, '\\')) !== false)
595 595
         {
596 596
             $sClassPath = substr($sClassName, 0, $nLastSlashPosition);
597 597
             $sClassName = substr($sClassName, $nLastSlashPosition + 1);
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         $sPartPath = str_replace('\\', $sDS, $sClassPath) . $sDS . $sClassName . '.php';
601 601
 
602 602
         // Search for the class file in all directories.
603
-        foreach($this->aClassDirs as $aClassDir)
603
+        foreach ($this->aClassDirs as $aClassDir)
604 604
         {
605 605
             // Get the separator
606 606
             $sSeparator = $aClassDir['separator'];
@@ -609,15 +609,15 @@  discard block
 block discarded – undo
609 609
             $nLen = strlen($sNamespace);
610 610
             $sFullPath = '';
611 611
             // Check if the class belongs to the namespace
612
-            if(($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace)
612
+            if (($sNamespace) && substr($sClassPath, 0, $nLen) == $sNamespace)
613 613
             {
614 614
                 $sFullPath = $aClassDir['directory'] . $sDS . substr($sPartPath, $nLen + 1);
615 615
             }
616
-            elseif(!($sNamespace))
616
+            elseif (!($sNamespace))
617 617
             {
618 618
                 $sFullPath = $aClassDir['directory'] . $sDS . $sPartPath;
619 619
             }
620
-            if(($sFullPath) && is_file($sFullPath))
620
+            if (($sFullPath) && is_file($sFullPath))
621 621
             {
622 622
                 // Found the file in this directory
623 623
                 $xFileInfo = new \SplFileInfo($sFullPath);
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
     {
642 642
         $xObject = null; // The user registered object
643 643
         $xPlugin = $this->getRequestPlugin('CallableObject'); // The CallableObject plugin
644
-        if(($xPlugin))
644
+        if (($xPlugin))
645 645
         {
646 646
             $xObject = $xPlugin->getRegisteredObject($sClassName);
647 647
         }
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
      */
656 656
     private function getJsLibUri()
657 657
     {
658
-        if(!$this->hasOption('js.lib.uri'))
658
+        if (!$this->hasOption('js.lib.uri'))
659 659
         {
660 660
             // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/';
661 661
             return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/';
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
         // The jsDelivr CDN only hosts minified files
679 679
         // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri)
680 680
         // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files.
681
-        if(($this->getOption('js.app.minify')))
681
+        if (($this->getOption('js.app.minify')))
682 682
         {
683 683
             return '.min.js';
684 684
         }
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
         // Check config options
696 696
         // - The js.app.extern option must be set to true
697 697
         // - The js.app.uri and js.app.dir options must be set to non null values
698
-        if(!$this->getOption('js.app.extern') ||
698
+        if (!$this->getOption('js.app.extern') ||
699 699
             !$this->getOption('js.app.uri') ||
700 700
             !$this->getOption('js.app.dir'))
701 701
         {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         // Check dir access
705 705
         // - The js.app.dir must be writable
706 706
         $sJsAppDir = $this->getOption('js.app.dir');
707
-        if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
707
+        if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
708 708
         {
709 709
             return false;
710 710
         }
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      */
719 719
     private function setTemplateCacheDir()
720 720
     {
721
-        if($this->hasOption('core.template.cache_dir'))
721
+        if ($this->hasOption('core.template.cache_dir'))
722 722
         {
723 723
             $this->setCacheDir($this->getOption('core.template.cache_dir'));
724 724
         }
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
 
741 741
         // Add component files to the javascript file array;
742 742
         $aJsFiles = array($sJsCoreUrl);
743
-        if($this->getOption('core.debug.on'))
743
+        if ($this->getOption('core.debug.on'))
744 744
         {
745 745
             $aJsFiles[] = $sJsDebugUrl;
746 746
             $aJsFiles[] = $sJsLanguageUrl;
@@ -756,17 +756,17 @@  discard block
 block discarded – undo
756 756
             'sJsOptions' => $this->getOption('js.app.options'),
757 757
             'aUrls' => $aJsFiles,
758 758
         ));
759
-        foreach($this->aResponsePlugins as $xPlugin)
759
+        foreach ($this->aResponsePlugins as $xPlugin)
760 760
         {
761
-            if(($str = trim($xPlugin->getJs())))
761
+            if (($str = trim($xPlugin->getJs())))
762 762
             {
763 763
                 $sCode .= rtrim($str, " \n") . "\n";
764 764
             }
765 765
         }
766
-        foreach($this->aPackages as $sClass)
766
+        foreach ($this->aPackages as $sClass)
767 767
         {
768 768
             $xPackage = jaxon()->di()->get($sClass);
769
-            if(($str = trim($xPackage->js())))
769
+            if (($str = trim($xPackage->js())))
770 770
             {
771 771
                 $sCode .= rtrim($str, " \n") . "\n";
772 772
             }
@@ -785,17 +785,17 @@  discard block
 block discarded – undo
785 785
         $this->setTemplateCacheDir();
786 786
 
787 787
         $sCode = '';
788
-        foreach($this->aResponsePlugins as $xPlugin)
788
+        foreach ($this->aResponsePlugins as $xPlugin)
789 789
         {
790
-            if(($str = trim($xPlugin->getCss())))
790
+            if (($str = trim($xPlugin->getCss())))
791 791
             {
792 792
                 $sCode .= rtrim($str, " \n") . "\n";
793 793
             }
794 794
         }
795
-        foreach($this->aPackages as $sClass)
795
+        foreach ($this->aPackages as $sClass)
796 796
         {
797 797
             $xPackage = jaxon()->di()->get($sClass);
798
-            if(($str = trim($xPackage->css())))
798
+            if (($str = trim($xPackage->css())))
799 799
             {
800 800
                 $sCode .= rtrim($str, " \n") . "\n";
801 801
             }
@@ -859,17 +859,17 @@  discard block
 block discarded – undo
859 859
     private function getReadyScript()
860 860
     {
861 861
         $sPluginScript = '';
862
-        foreach($this->aResponsePlugins as $xPlugin)
862
+        foreach ($this->aResponsePlugins as $xPlugin)
863 863
         {
864
-            if(($str = trim($xPlugin->getScript())))
864
+            if (($str = trim($xPlugin->getScript())))
865 865
             {
866 866
                 $sPluginScript .= "\n" . trim($str, " \n");
867 867
             }
868 868
         }
869
-        foreach($this->aPackages as $sClass)
869
+        foreach ($this->aPackages as $sClass)
870 870
         {
871 871
             $xPackage = jaxon()->di()->get($sClass);
872
-            if(($str = trim($xPackage->ready())))
872
+            if (($str = trim($xPackage->ready())))
873 873
             {
874 874
                 $sPluginScript .= "\n" . trim($str, " \n");
875 875
             }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
     {
893 893
         // Get the config and plugins scripts
894 894
         $sScript = $this->getConfigScript() . "\n" . $this->getReadyScript() . "\n";
895
-        foreach($this->aRequestPlugins as $xPlugin)
895
+        foreach ($this->aRequestPlugins as $xPlugin)
896 896
         {
897 897
             $sScript .= "\n" . trim($xPlugin->getScript(), " \n");
898 898
         }
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
         // Set the template engine cache dir
915 915
         $this->setTemplateCacheDir();
916 916
 
917
-        if($this->canExportJavascript())
917
+        if ($this->canExportJavascript())
918 918
         {
919 919
             $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/';
920 920
             $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/';
@@ -923,13 +923,13 @@  discard block
 block discarded – undo
923 923
             $sHash = $this->generateHash();
924 924
             $sOutFile = $sHash . '.js';
925 925
             $sMinFile = $sHash . '.min.js';
926
-            if(!is_file($sJsAppDir . $sOutFile))
926
+            if (!is_file($sJsAppDir . $sOutFile))
927 927
             {
928 928
                 file_put_contents($sJsAppDir . $sOutFile, $this->getAllScripts());
929 929
             }
930
-            if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
930
+            if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
931 931
             {
932
-                if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
932
+                if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
933 933
                 {
934 934
                     $sOutFile = $sMinFile;
935 935
                 }
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
      */
963 963
     public function getResponsePlugin($sName)
964 964
     {
965
-        if(array_key_exists($sName, $this->aResponsePlugins))
965
+        if (array_key_exists($sName, $this->aResponsePlugins))
966 966
         {
967 967
             return $this->aResponsePlugins[$sName];
968 968
         }
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
      */
979 979
     public function getRequestPlugin($sName)
980 980
     {
981
-        if(array_key_exists($sName, $this->aRequestPlugins))
981
+        if (array_key_exists($sName, $this->aRequestPlugins))
982 982
         {
983 983
             return $this->aRequestPlugins[$sName];
984 984
         }
Please login to merge, or discard this patch.
src/Utils/Validation/Validator.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
         // Verify the file extension
130 130
         $xDefault = $this->xConfig->getOption('upload.default.types');
131 131
         $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.types', $xDefault);
132
-        if(is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed))
132
+        if (is_array($aAllowed) && !in_array($aUploadedFile['type'], $aAllowed))
133 133
         {
134 134
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.type', $aUploadedFile);
135 135
             return false;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         // Verify the file extension
138 138
         $xDefault = $this->xConfig->getOption('upload.default.extensions');
139 139
         $aAllowed = $this->xConfig->getOption('upload.files.' . $sName . '.extensions', $xDefault);
140
-        if(is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed))
140
+        if (is_array($aAllowed) && !in_array($aUploadedFile['extension'], $aAllowed))
141 141
         {
142 142
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.extension', $aUploadedFile);
143 143
             return false;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         // Verify the max size
146 146
         $xDefault = $this->xConfig->getOption('upload.default.max-size', 0);
147 147
         $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.max-size', $xDefault);
148
-        if($iSize > 0 && $aUploadedFile['size'] > $iSize)
148
+        if ($iSize > 0 && $aUploadedFile['size'] > $iSize)
149 149
         {
150 150
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.max-size', $aUploadedFile);
151 151
             return false;
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         // Verify the min size
154 154
         $xDefault = $this->xConfig->getOption('upload.default.min-size', 0);
155 155
         $iSize = $this->xConfig->getOption('upload.files.' . $sName . '.min-size', $xDefault);
156
-        if($iSize > 0 && $aUploadedFile['size'] < $iSize)
156
+        if ($iSize > 0 && $aUploadedFile['size'] < $iSize)
157 157
         {
158 158
             $this->sErrorMessage = $this->xTranslator->trans('errors.upload.min-size', $aUploadedFile);
159 159
             return false;
Please login to merge, or discard this patch.
src/Utils/Translation/Translator.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -121,7 +121,7 @@
 block discarded – undo
121 121
         }
122 122
         if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124
-           return $sText;
124
+            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127 127
         foreach($aPlaceHolders as $name => $value)
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@
 block discarded – undo
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
66
-            }
67
-            else
66
+            } else
68 67
             {
69 68
                 // Recursively read the translations in the array
70 69
                 $this->_loadTranslations($sLanguage, $sName, $xTranslation);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
      */
56 56
     private function _loadTranslations($sLanguage, $sPrefix, array $aTranslations)
57 57
     {
58
-        foreach($aTranslations as $sName => $xTranslation)
58
+        foreach ($aTranslations as $sName => $xTranslation)
59 59
         {
60 60
             $sName = trim($sName);
61 61
             $sName = ($sPrefix) ? $sPrefix . '.' . $sName : $sName;
62
-            if(!is_array($xTranslation))
62
+            if (!is_array($xTranslation))
63 63
             {
64 64
                 // Save this translation
65 65
                 $this->aTranslations[$sLanguage][$sName] = $xTranslation;
@@ -82,17 +82,17 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function loadTranslations($sFilePath, $sLanguage)
84 84
     {
85
-        if(!file_exists($sFilePath))
85
+        if (!file_exists($sFilePath))
86 86
         {
87 87
             return;
88 88
         }
89 89
         $aTranslations = require($sFilePath);
90
-        if(!is_array($aTranslations))
90
+        if (!is_array($aTranslations))
91 91
         {
92 92
             return;
93 93
         }
94 94
         // Load the translations
95
-        if(!array_key_exists($sLanguage, $this->aTranslations))
95
+        if (!array_key_exists($sLanguage, $this->aTranslations))
96 96
         {
97 97
             $this->aTranslations[$sLanguage] = [];
98 98
         }
@@ -111,20 +111,20 @@  discard block
 block discarded – undo
111 111
     public function trans($sText, array $aPlaceHolders = [], $sLanguage = null)
112 112
     {
113 113
         $sText = trim((string)$sText);
114
-        if(!$sLanguage)
114
+        if (!$sLanguage)
115 115
         {
116 116
             $sLanguage = $this->xConfig->getOption('language');
117 117
         }
118
-        if(!$sLanguage)
118
+        if (!$sLanguage)
119 119
         {
120 120
             $sLanguage = $this->sDefaultLocale;
121 121
         }
122
-        if(!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
122
+        if (!array_key_exists($sLanguage, $this->aTranslations) || !array_key_exists($sText, $this->aTranslations[$sLanguage]))
123 123
         {
124 124
            return $sText;
125 125
         }
126 126
         $message = $this->aTranslations[$sLanguage][$sText];
127
-        foreach($aPlaceHolders as $name => $value)
127
+        foreach ($aPlaceHolders as $name => $value)
128 128
         {
129 129
             $message = str_replace(':' . $name, $value, $message);
130 130
         }
Please login to merge, or discard this patch.