Completed
Push — master ( 8baf0c...71f3ca )
by Thierry
01:39
created
src/Request/Manager.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
      *
153 153
      * @param string        $sArg                The Jaxon request argument
154 154
      *
155
-     * @return mixed
155
+     * @return string|null
156 156
      */
157 157
     private function __argumentDecode(&$sArg)
158 158
     {
Please login to merge, or discard this patch.
Switch Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -131,19 +131,19 @@
 block discarded – undo
131 131
         $sValue = substr($sValue, 1);
132 132
         switch ($cType)
133 133
         {
134
-            case 'S':
135
-                $value = ($sValue === false ? '' : $sValue);
136
-                break;
137
-            case 'B':
138
-                $value = $this->__convertStringToBool($sValue);
139
-                break;
140
-            case 'N':
141
-                $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
-                break;
143
-            case '*':
144
-            default:
145
-                $value = null;
146
-                break;
134
+        case 'S':
135
+            $value = ($sValue === false ? '' : $sValue);
136
+            break;
137
+        case 'B':
138
+            $value = $this->__convertStringToBool($sValue);
139
+            break;
140
+        case 'N':
141
+            $value = ($sValue == floor($sValue) ? (int)$sValue : (float)$sValue);
142
+            break;
143
+        case '*':
144
+        default:
145
+            $value = null;
146
+            break;
147 147
         }
148 148
         return $value;
149 149
     }
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -59,8 +59,7 @@  discard block
 block discarded – undo
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62
-        }
63
-        elseif(isset($_GET['jxnargs']))
62
+        } elseif(isset($_GET['jxnargs']))
64 63
         {
65 64
             $this->nMethod = Jaxon::METHOD_GET;
66 65
             $this->aArgs = $_GET['jxnargs'];
@@ -169,8 +168,7 @@  discard block
 block discarded – undo
169 168
         if(key_exists('CONTENT_TYPE', $_SERVER))
170 169
         {
171 170
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
172
-        }
173
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
171
+        } elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
174 172
         {
175 173
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
176 174
         }
@@ -184,8 +182,7 @@  discard block
 block discarded – undo
184 182
         if($data !== null && $sArg != $data)
185 183
         {
186 184
             $sArg = $data;
187
-        }
188
-        else
185
+        } else
189 186
         {
190 187
             $sArg = $this->__convertValue($sArg);
191 188
         }
@@ -214,8 +211,7 @@  discard block
 block discarded – undo
214 211
                 }
215 212
                 $this->__argumentDecodeUTF8_iconv($xArg);
216 213
             }
217
-        }
218
-        elseif(is_string($mArg))
214
+        } elseif(is_string($mArg))
219 215
         {
220 216
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
221 217
         }
@@ -244,8 +240,7 @@  discard block
 block discarded – undo
244 240
                 }
245 241
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
246 242
             }
247
-        }
248
-        elseif(is_string($mArg))
243
+        } elseif(is_string($mArg))
249 244
         {
250 245
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
251 246
         }
@@ -276,8 +271,7 @@  discard block
 block discarded – undo
276 271
                 
277 272
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
278 273
             }
279
-        }
280
-        elseif(is_string($mArg))
274
+        } elseif(is_string($mArg))
281 275
         {
282 276
             $mArg = utf8_decode($mArg);
283 277
         }
@@ -309,16 +303,13 @@  discard block
 block discarded – undo
309 303
             if(function_exists('iconv'))
310 304
             {
311 305
                 $sFunction = "iconv";
312
-            }
313
-            elseif(function_exists('mb_convert_encoding'))
306
+            } elseif(function_exists('mb_convert_encoding'))
314 307
             {
315 308
                 $sFunction = "mb_convert_encoding";
316
-            }
317
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
309
+            } elseif($this->getOption('core.encoding') == "ISO-8859-1")
318 310
             {
319 311
                 $sFunction = "utf8_decode";
320
-            }
321
-            else
312
+            } else
322 313
             {
323 314
                 throw new \Jaxon\Exception\Error($this->trans('errors.request.conversion'));
324 315
             }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
         $this->aArgs = [];
56 56
         $this->nMethod = Jaxon::METHOD_UNKNOWN;
57 57
 
58
-        if(isset($_POST['jxnargs']))
58
+        if (isset($_POST['jxnargs']))
59 59
         {
60 60
             $this->nMethod = Jaxon::METHOD_POST;
61 61
             $this->aArgs = $_POST['jxnargs'];
62 62
         }
63
-        elseif(isset($_GET['jxnargs']))
63
+        elseif (isset($_GET['jxnargs']))
64 64
         {
65 65
             $this->nMethod = Jaxon::METHOD_GET;
66 66
             $this->aArgs = $_GET['jxnargs'];
67 67
         }
68
-        if(get_magic_quotes_gpc() == 1)
68
+        if (get_magic_quotes_gpc() == 1)
69 69
         {
70 70
             array_walk($this->aArgs, array(&$this, '__argumentStripSlashes'));
71 71
         }
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
      */
82 82
     private function __convertStringToBool($sValue)
83 83
     {
84
-        if(strcasecmp($sValue, 'true') == 0)
84
+        if (strcasecmp($sValue, 'true') == 0)
85 85
         {
86 86
             return true;
87 87
         }
88
-        if(strcasecmp($sValue, 'false') == 0)
88
+        if (strcasecmp($sValue, 'false') == 0)
89 89
         {
90 90
             return false;
91 91
         }
92
-        if(is_numeric($sValue))
92
+        if (is_numeric($sValue))
93 93
         {
94
-            if($sValue == 0)
94
+            if ($sValue == 0)
95 95
             {
96 96
                 return false;
97 97
             }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     private function __argumentStripSlashes(&$sArg)
111 111
     {
112
-        if(!is_string($sArg))
112
+        if (!is_string($sArg))
113 113
         {
114 114
             return '';
115 115
         }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      */
158 158
     private function __argumentDecode(&$sArg)
159 159
     {
160
-        if($sArg == '')
160
+        if ($sArg == '')
161 161
         {
162 162
             return '';
163 163
         }
@@ -166,22 +166,22 @@  discard block
 block discarded – undo
166 166
         $sType = 'multipart/form-data';
167 167
         $iLen = strlen($sType);
168 168
         $sContentType = '';
169
-        if(key_exists('CONTENT_TYPE', $_SERVER))
169
+        if (key_exists('CONTENT_TYPE', $_SERVER))
170 170
         {
171 171
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
172 172
         }
173
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
173
+        elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER))
174 174
         {
175 175
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
176 176
         }
177
-        if($sContentType == $sType)
177
+        if ($sContentType == $sType)
178 178
         {
179 179
             $sArg = urldecode($sArg);
180 180
         }
181 181
 
182 182
         $data = json_decode($sArg, true);
183 183
 
184
-        if($data !== null && $sArg != $data)
184
+        if ($data !== null && $sArg != $data)
185 185
         {
186 186
             $sArg = $data;
187 187
         }
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
      */
201 201
     private function __argumentDecodeUTF8_iconv(&$mArg)
202 202
     {
203
-        if(is_array($mArg))
203
+        if (is_array($mArg))
204 204
         {
205
-            foreach($mArg as $sKey => &$xArg)
205
+            foreach ($mArg as $sKey => &$xArg)
206 206
             {
207 207
                 $sNewKey = $sKey;
208 208
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
209
-                if($sNewKey != $sKey)
209
+                if ($sNewKey != $sKey)
210 210
                 {
211 211
                     $mArg[$sNewKey] = $xArg;
212 212
                     unset($mArg[$sKey]);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                 $this->__argumentDecodeUTF8_iconv($xArg);
216 216
             }
217 217
         }
218
-        elseif(is_string($mArg))
218
+        elseif (is_string($mArg))
219 219
         {
220 220
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
221 221
         }
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
      */
231 231
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
232 232
     {
233
-        if(is_array($mArg))
233
+        if (is_array($mArg))
234 234
         {
235
-            foreach($mArg as $sKey => &$xArg)
235
+            foreach ($mArg as $sKey => &$xArg)
236 236
             {
237 237
                 $sNewKey = $sKey;
238 238
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
239
-                if($sNewKey != $sKey)
239
+                if ($sNewKey != $sKey)
240 240
                 {
241 241
                     $mArg[$sNewKey] = $xArg;
242 242
                     unset($mArg[$sKey]);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
246 246
             }
247 247
         }
248
-        elseif(is_string($mArg))
248
+        elseif (is_string($mArg))
249 249
         {
250 250
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
251 251
         }
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
      */
261 261
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
262 262
     {
263
-        if(is_array($mArg))
263
+        if (is_array($mArg))
264 264
         {
265
-            foreach($mArg as $sKey => &$xArg)
265
+            foreach ($mArg as $sKey => &$xArg)
266 266
             {
267 267
                 $sNewKey = $sKey;
268 268
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
269 269
 
270
-                if($sNewKey != $sKey)
270
+                if ($sNewKey != $sKey)
271 271
                 {
272 272
                     $mArg[$sNewKey] = $xArg;
273 273
                     unset($mArg[$sKey]);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
278 278
             }
279 279
         }
280
-        elseif(is_string($mArg))
280
+        elseif (is_string($mArg))
281 281
         {
282 282
             $mArg = utf8_decode($mArg);
283 283
         }
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
      */
303 303
     public function process()
304 304
     {
305
-        if(($this->getOption('core.decode_utf8')))
305
+        if (($this->getOption('core.decode_utf8')))
306 306
         {
307 307
             $sFunction = '';
308 308
 
309
-            if(function_exists('iconv'))
309
+            if (function_exists('iconv'))
310 310
             {
311 311
                 $sFunction = "iconv";
312 312
             }
313
-            elseif(function_exists('mb_convert_encoding'))
313
+            elseif (function_exists('mb_convert_encoding'))
314 314
             {
315 315
                 $sFunction = "mb_convert_encoding";
316 316
             }
317
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
317
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
318 318
             {
319 319
                 $sFunction = "utf8_decode";
320 320
             }
Please login to merge, or discard this patch.
src/Request/Plugin/UserFunction.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,6 @@
 block discarded – undo
23 23
 
24 24
 use Jaxon\Jaxon;
25 25
 use Jaxon\Plugin\Request as RequestPlugin;
26
-use Jaxon\Request\Manager as RequestManager;
27 26
 
28 27
 class UserFunction extends RequestPlugin
29 28
 {
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@
 block discarded – undo
78 78
      * @param string        $sUserFunction  The name of the function being registered
79 79
      * @param array|string  $aOptions       The associated options
80 80
      *
81
-     * @return \Jaxon\Request\Request
81
+     * @return boolean
82 82
      */
83 83
     public function register($sType, $sUserFunction, $aOptions)
84 84
     {
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 
48 48
     public function __construct()
49 49
     {
50
-        if(isset($_GET['jxnfun']))
50
+        if (isset($_GET['jxnfun']))
51 51
         {
52 52
             $this->sRequestedFunction = $_GET['jxnfun'];
53 53
         }
54
-        if(isset($_POST['jxnfun']))
54
+        if (isset($_POST['jxnfun']))
55 55
         {
56 56
             $this->sRequestedFunction = $_POST['jxnfun'];
57 57
         }
@@ -78,30 +78,30 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function register($sType, $sUserFunction, $aOptions)
80 80
     {
81
-        if($sType != $this->getName())
81
+        if ($sType != $this->getName())
82 82
         {
83 83
             return false;
84 84
         }
85 85
 
86
-        if(!is_string($sUserFunction))
86
+        if (!is_string($sUserFunction))
87 87
         {
88 88
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
89 89
         }
90 90
 
91
-        if(is_string($aOptions))
91
+        if (is_string($aOptions))
92 92
         {
93 93
             $aOptions = ['include' => $aOptions];
94 94
         }
95
-        if(!is_array($aOptions))
95
+        if (!is_array($aOptions))
96 96
         {
97 97
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
98 98
         }
99 99
 
100 100
         // Check if an alias is defined
101 101
         $sFunctionName = $sUserFunction;
102
-        foreach($aOptions as $sName => $sValue)
102
+        foreach ($aOptions as $sName => $sValue)
103 103
         {
104
-            if($sName == 'alias')
104
+            if ($sName == 'alias')
105 105
             {
106 106
                 $sFunctionName = $sValue;
107 107
                 break;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         $this->aFunctions[$sFunctionName] = $aOptions;
112
-        jaxon()->di()->set($sFunctionName, function () use ($sFunctionName, $sUserFunction) {
112
+        jaxon()->di()->set($sFunctionName, function() use ($sFunctionName, $sUserFunction) {
113 113
             $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction);
114 114
 
115 115
             $aOptions = $this->aFunctions[$sFunctionName];
116
-            foreach($aOptions as $sName => $sValue)
116
+            foreach ($aOptions as $sName => $sValue)
117 117
             {
118 118
                 $xUserFunction->configure($sName, $sValue);
119 119
             }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $di = jaxon()->di();
145 145
         $code = '';
146
-        foreach(array_keys($this->aFunctions) as $sName)
146
+        foreach (array_keys($this->aFunctions) as $sName)
147 147
         {
148 148
             $xFunction = $di->get($sName);
149 149
             $code .= $xFunction->getScript();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     public function canProcessRequest()
160 160
     {
161 161
         // Check the validity of the function name
162
-        if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
162
+        if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
163 163
         {
164 164
             $this->sRequestedFunction = null;
165 165
         }
@@ -173,12 +173,12 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function processRequest()
175 175
     {
176
-        if(!$this->canProcessRequest())
176
+        if (!$this->canProcessRequest())
177 177
         {
178 178
             return false;
179 179
         }
180 180
 
181
-        if(!key_exists($this->sRequestedFunction, $this->aFunctions))
181
+        if (!key_exists($this->sRequestedFunction, $this->aFunctions))
182 182
         {
183 183
             // Unable to find the requested function
184 184
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $xFunction = jaxon()->di()->get($this->sRequestedFunction);
189 189
         $aArgs = $this->getRequestManager()->process();
190 190
         $xResponse = $xFunction->call($aArgs);
191
-        if(($xResponse))
191
+        if (($xResponse))
192 192
         {
193 193
             $this->getResponseManager()->append($xResponse);
194 194
         }
Please login to merge, or discard this patch.
src/Request/Request.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,6 @@
 block discarded – undo
20 20
 
21 21
 namespace Jaxon\Request;
22 22
 
23
-use JsonSerializable;
24 23
 use Jaxon\Jaxon;
25 24
 
26 25
 class Request extends JsCall
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -191,8 +191,7 @@  discard block
 block discarded – undo
191 191
                     $aVariables[$sParameterStr] = $sVarName;
192 192
                     $sVars .= "$sVarName=$xParameter;";
193 193
                     $nVarId++;
194
-                }
195
-                else
194
+                } else
196 195
                 {
197 196
                     // The value is already defined. The corresponding variable is assigned.
198 197
                     $sVarName = $aVariables[$sParameterStr];
@@ -221,8 +220,7 @@  discard block
 block discarded – undo
221 220
                             $aVariables[$sParameterStr] = $sVarName;
222 221
                             $sVars .= "$sVarName=$xParameter;";
223 222
                             $nVarId++;
224
-                        }
225
-                        else
223
+                        } else
226 224
                         {
227 225
                             // The value is already defined. The corresponding variable is assigned.
228 226
                             $sVarName = $aVariables[$sParameterStr];
@@ -241,8 +239,7 @@  discard block
 block discarded – undo
241 239
         {
242 240
             $xConfirm = $this->getPluginManager()->getConfirm();
243 241
             $sScript = $xConfirm->confirm($sPhrase, $sScript, '');
244
-        }
245
-        elseif($this->sCondition !== null)
242
+        } elseif($this->sCondition !== null)
246 243
         {
247 244
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
248 245
             if(($sPhrase))
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
      */
59 59
     public function hasPageNumber()
60 60
     {
61
-        foreach($this->aParameters as $xParameter)
61
+        foreach ($this->aParameters as $xParameter)
62 62
         {
63
-            if($xParameter->getType() == Jaxon::PAGE_NUMBER)
63
+            if ($xParameter->getType() == Jaxon::PAGE_NUMBER)
64 64
             {
65 65
                 return true;
66 66
             }
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
     public function setPageNumber($nPageNumber)
79 79
     {
80 80
         // Set the value of the Jaxon::PAGE_NUMBER parameter
81
-        foreach($this->aParameters as $xParameter)
81
+        foreach ($this->aParameters as $xParameter)
82 82
         {
83
-            if($xParameter->getType() == Jaxon::PAGE_NUMBER)
83
+            if ($xParameter->getType() == Jaxon::PAGE_NUMBER)
84 84
             {
85 85
                 $xParameter->setValue(intval($nPageNumber));
86 86
                 break;
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
     {
101 101
         $this->sCondition = '__confirm__';
102 102
         $this->aMessageArgs = func_get_args();
103
-        array_walk($this->aMessageArgs, function (&$xParameter) {
103
+        array_walk($this->aMessageArgs, function(&$xParameter) {
104 104
             $xParameter = Parameter::make($xParameter);
105 105
         });
106 106
         return $this;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     public function elseShow($sMessage)
234 234
     {
235 235
         $this->aMessageArgs = func_get_args();
236
-        array_walk($this->aMessageArgs, function (&$xParameter) {
236
+        array_walk($this->aMessageArgs, function(&$xParameter) {
237 237
             $xParameter = Parameter::make($xParameter);
238 238
         });
239 239
         return $this;
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
         // This array will avoid declaring multiple variables with the same value.
259 259
         // The array key is the variable value, while the array value is the variable name.
260 260
         $aVariables = []; // Array of local variables.
261
-        foreach($this->aParameters as &$xParameter)
261
+        foreach ($this->aParameters as &$xParameter)
262 262
         {
263 263
             $sParameterStr = $xParameter->getScript();
264
-            if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
264
+            if ($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
265 265
             {
266
-                if(!array_key_exists($sParameterStr, $aVariables))
266
+                if (!array_key_exists($sParameterStr, $aVariables))
267 267
                 {
268 268
                     // The value is not yet defined. A new variable is created.
269 269
                     $sVarName = "jxnVar$nVarId";
@@ -281,19 +281,19 @@  discard block
 block discarded – undo
281 281
         }
282 282
 
283 283
         $sPhrase = '';
284
-        if(count($this->aMessageArgs) > 0)
284
+        if (count($this->aMessageArgs) > 0)
285 285
         {
286 286
             $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question.
287 287
             // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes
288
-            if(count($this->aMessageArgs) > 0)
288
+            if (count($this->aMessageArgs) > 0)
289 289
             {
290 290
                 $nParamId = 1;
291
-                foreach($this->aMessageArgs as &$xParameter)
291
+                foreach ($this->aMessageArgs as &$xParameter)
292 292
                 {
293 293
                     $sParameterStr = $xParameter->getScript();
294
-                    if($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
294
+                    if ($xParameter instanceof \Jaxon\Response\Plugin\JQuery\Dom\Element)
295 295
                     {
296
-                        if(!array_key_exists($sParameterStr, $aVariables))
296
+                        if (!array_key_exists($sParameterStr, $aVariables))
297 297
                         {
298 298
                             // The value is not yet defined. A new variable is created.
299 299
                             $sVarName = "jxnVar$nVarId";
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
         }
317 317
 
318 318
         $sScript = parent::getScript();
319
-        if($this->sCondition == '__confirm__')
319
+        if ($this->sCondition == '__confirm__')
320 320
         {
321 321
             $xConfirm = $this->getPluginManager()->getConfirm();
322 322
             $sScript = $xConfirm->confirm($sPhrase, $sScript, '');
323 323
         }
324
-        elseif($this->sCondition !== null)
324
+        elseif ($this->sCondition !== null)
325 325
         {
326 326
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
327
-            if(($sPhrase))
327
+            if (($sPhrase))
328 328
             {
329 329
                 $xAlert = $this->getPluginManager()->getAlert();
330 330
                 $xAlert->setReturn(true);
Please login to merge, or discard this patch.
src/Request/Traits/Factory.php 1 patch
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,6 @@  discard block
 block discarded – undo
89 89
      * Return the javascript call to an Jaxon object method
90 90
      *
91 91
      * @param string         $sMethod           The method (without class) name
92
-     * @param ...            $xParams           The parameters of the method
93 92
      *
94 93
      * @return object
95 94
      */
@@ -110,7 +109,6 @@  discard block
 block discarded – undo
110 109
      * @param integer $nItemsPerPage the number of items per page
111 110
      * @param integer $nCurrentPage the current page
112 111
      * @param string  $sMethod the name of the method
113
-     * @param ... $parameters the parameters of the method
114 112
      *
115 113
      * @return string the pagination links
116 114
      */
Please login to merge, or discard this patch.
src/Utils/Pagination/Paginator.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -161,7 +161,7 @@
 block discarded – undo
161 161
     }
162 162
 
163 163
     /**
164
-     * @return string
164
+     * @return Request
165 165
      */
166 166
     public function getRequest()
167 167
     {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -265,8 +265,7 @@  discard block
 block discarded – undo
265 265
             {
266 266
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
267 267
             }
268
-        }
269
-        else
268
+        } else
270 269
         {
271 270
             // Determine the sliding range, centered around the current page.
272 271
             $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2);
@@ -274,8 +273,7 @@  discard block
 block discarded – undo
274 273
             if($this->currentPage + $numAdjacents > $this->numPages)
275 274
             {
276 275
                 $slidingStart = $this->numPages - $this->maxPagesToShow + 2;
277
-            }
278
-            else
276
+            } else
279 277
             {
280 278
                 $slidingStart = $this->currentPage - $numAdjacents;
281 279
             }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     protected function updateNumPages()
67 67
     {
68
-        $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int) ceil($this->totalItems/$this->itemsPerPage));
68
+        $this->numPages = ($this->itemsPerPage == 0 ? 0 : (int)ceil($this->totalItems / $this->itemsPerPage));
69 69
     }
70 70
 
71 71
     /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function setMaxPagesToShow($maxPagesToShow)
76 76
     {
77
-        if($maxPagesToShow < 3)
77
+        if ($maxPagesToShow < 3)
78 78
         {
79 79
             throw new \InvalidArgumentException('maxPagesToShow cannot be less than 3.');
80 80
         }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     {
155 155
         $this->request = $request;
156 156
         // Append the page number to the parameter list, if not yet given.
157
-        if(($this->request) && !$this->request->hasPageNumber())
157
+        if (($this->request) && !$this->request->hasPageNumber())
158 158
         {
159 159
             $this->request->addParameter(Jaxon::PAGE_NUMBER, 0);
160 160
         }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
     public function getNextPage()
195 195
     {
196
-        if($this->currentPage < $this->numPages)
196
+        if ($this->currentPage < $this->numPages)
197 197
         {
198 198
             return $this->currentPage + 1;
199 199
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
     public function getPrevPage()
205 205
     {
206
-        if($this->currentPage > 1)
206
+        if ($this->currentPage > 1)
207 207
         {
208 208
             return $this->currentPage - 1;
209 209
         }
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 
214 214
     public function getNextCall()
215 215
     {
216
-        if(!$this->getNextPage())
216
+        if (!$this->getNextPage())
217 217
         {
218 218
             return null;
219 219
         }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
      */
227 227
     public function getPrevCall()
228 228
     {
229
-        if(!$this->getPrevPage())
229
+        if (!$this->getPrevPage())
230 230
         {
231 231
             return null;
232 232
         }
@@ -254,14 +254,14 @@  discard block
 block discarded – undo
254 254
     {
255 255
         $pages = [];
256 256
 
257
-        if($this->numPages <= 1)
257
+        if ($this->numPages <= 1)
258 258
         {
259 259
             return [];
260 260
         }
261 261
 
262
-        if($this->numPages <= $this->maxPagesToShow)
262
+        if ($this->numPages <= $this->maxPagesToShow)
263 263
         {
264
-            for($i = 1; $i <= $this->numPages; $i++)
264
+            for ($i = 1; $i <= $this->numPages; $i++)
265 265
             {
266 266
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
267 267
             }
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
         else
270 270
         {
271 271
             // Determine the sliding range, centered around the current page.
272
-            $numAdjacents = (int) floor(($this->maxPagesToShow - 3) / 2);
272
+            $numAdjacents = (int)floor(($this->maxPagesToShow - 3) / 2);
273 273
 
274
-            if($this->currentPage + $numAdjacents > $this->numPages)
274
+            if ($this->currentPage + $numAdjacents > $this->numPages)
275 275
             {
276 276
                 $slidingStart = $this->numPages - $this->maxPagesToShow + 2;
277 277
             }
@@ -279,28 +279,28 @@  discard block
 block discarded – undo
279 279
             {
280 280
                 $slidingStart = $this->currentPage - $numAdjacents;
281 281
             }
282
-            if($slidingStart < 2)
282
+            if ($slidingStart < 2)
283 283
             {
284 284
                 $slidingStart = 2;
285 285
             }
286 286
 
287 287
             $slidingEnd = $slidingStart + $this->maxPagesToShow - 3;
288
-            if($slidingEnd >= $this->numPages)
288
+            if ($slidingEnd >= $this->numPages)
289 289
             {
290 290
                 $slidingEnd = $this->numPages - 1;
291 291
             }
292 292
 
293 293
             // Build the list of pages.
294 294
             $pages[] = $this->createPage(1, $this->currentPage == 1);
295
-            if($slidingStart > 2)
295
+            if ($slidingStart > 2)
296 296
             {
297 297
                 $pages[] = $this->createPageEllipsis();
298 298
             }
299
-            for($i = $slidingStart; $i <= $slidingEnd; $i++)
299
+            for ($i = $slidingStart; $i <= $slidingEnd; $i++)
300 300
             {
301 301
                 $pages[] = $this->createPage($i, $i == $this->currentPage);
302 302
             }
303
-            if($slidingEnd < $this->numPages - 1)
303
+            if ($slidingEnd < $this->numPages - 1)
304 304
             {
305 305
                 $pages[] = $this->createPageEllipsis();
306 306
             }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
      */
347 347
     public function toHtml()
348 348
     {
349
-        if($this->getNumPages() <= 1)
349
+        if ($this->getNumPages() <= 1)
350 350
         {
351 351
             return '';
352 352
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
     {
370 370
         $first = ($this->currentPage - 1) * $this->itemsPerPage + 1;
371 371
 
372
-        if($first > $this->totalItems)
372
+        if ($first > $this->totalItems)
373 373
         {
374 374
             return null;
375 375
         }
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
     public function getCurrentPageLastItem()
381 381
     {
382 382
         $first = $this->getCurrentPageFirstItem();
383
-        if($first === null)
383
+        if ($first === null)
384 384
         {
385 385
             return null;
386 386
         }
387 387
 
388 388
         $last = $first + $this->itemsPerPage - 1;
389
-        if($last > $this->totalItems)
389
+        if ($last > $this->totalItems)
390 390
         {
391 391
             return $this->totalItems;
392 392
         }
Please login to merge, or discard this patch.
src/Request/JsCall.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -168,9 +168,9 @@
 block discarded – undo
168 168
      */
169 169
     public function addParameters(array $aParameters)
170 170
     {
171
-        foreach($aParameters as $xParameter)
171
+        foreach ($aParameters as $xParameter)
172 172
         {
173
-            if($xParameter instanceof JsCall)
173
+            if ($xParameter instanceof JsCall)
174 174
             {
175 175
                 $this->addParameter(Jaxon::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
176 176
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,7 @@
 block discarded – undo
173 173
             if($xParameter instanceof JsCall)
174 174
             {
175 175
                 $this->addParameter(Jaxon::JS_VALUE, 'function(){' . $xParameter->getScript() . ';}');
176
-            }
177
-            else
176
+            } else
178 177
             {
179 178
                 $this->pushParameter(Parameter::make($xParameter));
180 179
             }
Please login to merge, or discard this patch.
src/Utils/Template/Template.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function addNamespace($sNamespace, $sDirectory, $sExtension = '')
46 46
     {
47 47
         // The 'jaxon' key cannot be overriden
48
-        if($sNamespace == 'jaxon')
48
+        if ($sNamespace == 'jaxon')
49 49
         {
50 50
             return;
51 51
         }
@@ -82,18 +82,18 @@  discard block
 block discarded – undo
82 82
         // Get the namespace name
83 83
         $sNamespace = '';
84 84
         $iSeparatorPosition = strrpos($sTemplate, '::');
85
-        if($iSeparatorPosition !== false)
85
+        if ($iSeparatorPosition !== false)
86 86
         {
87 87
             $sNamespace = substr($sTemplate, 0, $iSeparatorPosition);
88 88
             $sTemplate = substr($sTemplate, $iSeparatorPosition + 2);
89 89
         }
90 90
         // The default namespace is 'jaxon'
91
-        if(!($sNamespace = trim($sNamespace)))
91
+        if (!($sNamespace = trim($sNamespace)))
92 92
         {
93 93
             $sNamespace = 'jaxon';
94 94
         }
95 95
         // Check if the namespace is defined
96
-        if(!key_exists($sNamespace, $this->aNamespaces))
96
+        if (!key_exists($sNamespace, $this->aNamespaces))
97 97
         {
98 98
             return false;
99 99
         }
Please login to merge, or discard this patch.
src/Plugin/Plugin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -80,11 +80,11 @@
 block discarded – undo
80 80
     protected function includeAssets()
81 81
     {
82 82
         $sPluginOptionName = 'assets.include.' . $this->getName();
83
-        if($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName))
83
+        if ($this->hasOption($sPluginOptionName) && !$this->getOption($sPluginOptionName))
84 84
         {
85 85
             return false;
86 86
         }
87
-        if($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all'))
87
+        if ($this->hasOption('assets.include.all') && !$this->getOption('assets.include.all'))
88 88
         {
89 89
             return false;
90 90
         }
Please login to merge, or discard this patch.
templates/pagination/wrapper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <ul class="pagination">
2 2
 <?php
3
-    if(($this->prev))
3
+    if (($this->prev))
4 4
     {
5 5
         echo $this->prev;
6 6
     }
7 7
     echo $this->links;
8
-    if(($this->next))
8
+    if (($this->next))
9 9
     {
10 10
         echo $this->next;
11 11
     }
Please login to merge, or discard this patch.