Completed
Push — master ( 5d7b0f...8d92ea )
by Thierry
03:20
created
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.
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";
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
 
318 318
         $sScript = parent::getScript();
319 319
         $xDialog = jaxon()->dialog();
320
-        if($this->sCondition == '__confirm__')
320
+        if ($this->sCondition == '__confirm__')
321 321
         {
322 322
             $sScript = $xDialog->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
                 $xDialog->getAlert()->setReturn(true);
330 330
                 $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}';
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -270,8 +270,7 @@  discard block
 block discarded – undo
270 270
                     $aVariables[$sParameterStr] = $sVarName;
271 271
                     $sVars .= "$sVarName=$xParameter;";
272 272
                     $nVarId++;
273
-                }
274
-                else
273
+                } else
275 274
                 {
276 275
                     // The value is already defined. The corresponding variable is assigned.
277 276
                     $sVarName = $aVariables[$sParameterStr];
@@ -300,8 +299,7 @@  discard block
 block discarded – undo
300 299
                             $aVariables[$sParameterStr] = $sVarName;
301 300
                             $sVars .= "$sVarName=$xParameter;";
302 301
                             $nVarId++;
303
-                        }
304
-                        else
302
+                        } else
305 303
                         {
306 304
                             // The value is already defined. The corresponding variable is assigned.
307 305
                             $sVarName = $aVariables[$sParameterStr];
@@ -320,8 +318,7 @@  discard block
 block discarded – undo
320 318
         if($this->sCondition == '__confirm__')
321 319
         {
322 320
             $sScript = $xDialog->confirm($sPhrase, $sScript, '');
323
-        }
324
-        elseif($this->sCondition !== null)
321
+        } elseif($this->sCondition !== null)
325 322
         {
326 323
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
327 324
             if(($sPhrase))
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.
templates/support/function.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php echo $this->sPrefix ?><?php echo $this->sAlias ?> = function() {
2 2
     return jaxon.request(
3 3
         { jxnfun: '<?php echo $this->sFunction ?>' },
4
-        { parameters: arguments<?php foreach($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }
4
+        { parameters: arguments<?php foreach ($this->aConfig as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }
5 5
     );
6 6
 };
Please login to merge, or discard this patch.
templates/support/object.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php echo $this->sPrefix ?><?php echo $this->sClass ?> = {};
2
-<?php foreach($this->aMethods as $aMethod): ?>
2
+<?php foreach ($this->aMethods as $aMethod): ?>
3 3
 <?php echo $this->sPrefix ?><?php echo $this->sClass ?>.<?php echo $aMethod['name'] ?> = function() {
4 4
     return jaxon.request(
5 5
         { jxncls: '<?php echo $this->sClass ?>', jxnmthd: '<?php echo $aMethod['name'] ?>' },
6
-        { parameters: arguments<?php foreach($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }
6
+        { parameters: arguments<?php foreach ($aMethod['config'] as $sKey => $sValue): ?>, <?php echo $sKey ?>: <?php echo $sValue ?><?php endforeach ?> }
7 7
     );
8 8
 };
9 9
 <?php endforeach ?>
Please login to merge, or discard this patch.
templates/support/event.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php echo $this->sPrefix ?><?php echo $this->sEvent ?> = function() {
2 2
     return jaxon.request(
3 3
         { jxnevt: '<?php echo $this->sEvent ?>' },
4
-        { parameters: arguments<?php if(($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if(($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> }
4
+        { parameters: arguments<?php if (($this->sMode)): ?>, mode: '<?php echo $this->sMode ?>'<?php endif ?><?php if (($this->sMethod)): ?>, method: '<?php echo $this->sMethod ?>'<?php endif ?> }
5 5
     );
6 6
 };
Please login to merge, or discard this patch.