Completed
Push — master ( 887921...ad91dd )
by Thierry
01:28
created
src/Request/Factory/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\Factory;
22 22
 
23
-use JsonSerializable;
24 23
 use Jaxon\Request\Factory\Parameter;
25 24
 use Jaxon\Request\Factory\Contracts\Parameter as ParameterContract;
26 25
 use Jaxon\Response\Plugin\JQuery\Dom\Element as DomElement;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function hasPageNumber()
55 55
     {
56
-        foreach($this->aParameters as $xParameter)
56
+        foreach ($this->aParameters as $xParameter)
57 57
         {
58
-            if($xParameter->getType() == Parameter::PAGE_NUMBER)
58
+            if ($xParameter->getType() == Parameter::PAGE_NUMBER)
59 59
             {
60 60
                 return true;
61 61
             }
@@ -73,9 +73,9 @@  discard block
 block discarded – undo
73 73
     public function setPageNumber($nPageNumber)
74 74
     {
75 75
         // Set the value of the Parameter::PAGE_NUMBER parameter
76
-        foreach($this->aParameters as $xParameter)
76
+        foreach ($this->aParameters as $xParameter)
77 77
         {
78
-            if($xParameter->getType() == Parameter::PAGE_NUMBER)
78
+            if ($xParameter->getType() == Parameter::PAGE_NUMBER)
79 79
             {
80 80
                 $xParameter->setValue(intval($nPageNumber));
81 81
                 break;
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     private function setMessageArgs(array $aArgs)
95 95
     {
96
-        array_walk($aArgs, function (&$xParameter) {
96
+        array_walk($aArgs, function(&$xParameter) {
97 97
             $xParameter = Parameter::make($xParameter);
98 98
         });
99 99
         $this->aMessageArgs = $aArgs;
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
      */
142 142
     private function _makeUniqueJsVar(ParameterContract $xParameter, array &$aVariables, &$sVars, &$nVarId)
143 143
     {
144
-        if($xParameter instanceof DomElement)
144
+        if ($xParameter instanceof DomElement)
145 145
         {
146 146
             $sParameterStr = $xParameter->getScript();
147
-            if(!array_key_exists($sParameterStr, $aVariables))
147
+            if (!array_key_exists($sParameterStr, $aVariables))
148 148
             {
149 149
                 // The value is not yet defined. A new variable is created.
150 150
                 $sVarName = "jxnVar$nVarId";
@@ -181,20 +181,20 @@  discard block
 block discarded – undo
181 181
         // This array will avoid declaring multiple variables with the same value.
182 182
         // The array key is the variable value, while the array value is the variable name.
183 183
         $aVariables = []; // Array of local variables.
184
-        foreach($this->aParameters as &$xParameter)
184
+        foreach ($this->aParameters as &$xParameter)
185 185
         {
186 186
             $xParameter = $this->_makeUniqueJsVar($xParameter, $aVariables, $sVars, $nVarId);
187 187
         }
188 188
 
189 189
         $sPhrase = '';
190
-        if(count($this->aMessageArgs) > 0)
190
+        if (count($this->aMessageArgs) > 0)
191 191
         {
192 192
             $sPhrase = array_shift($this->aMessageArgs); // The first array entry is the question.
193 193
             // $sPhrase = "'" . addslashes($sPhrase) . "'"; // Wrap the phrase with single quotes
194
-            if(count($this->aMessageArgs) > 0)
194
+            if (count($this->aMessageArgs) > 0)
195 195
             {
196 196
                 $nParamId = 1;
197
-                foreach($this->aMessageArgs as &$xParameter)
197
+                foreach ($this->aMessageArgs as &$xParameter)
198 198
                 {
199 199
                     $xParameter = $this->_makeUniqueJsVar($xParameter, $aVariables, $sVars, $nVarId);
200 200
                     $xParameter = "'$nParamId':" . $xParameter->getScript();
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 
207 207
         $sScript = parent::getScript();
208 208
         $xDialog = jaxon()->dialog();
209
-        if($this->sCondition == '__confirm__')
209
+        if ($this->sCondition == '__confirm__')
210 210
         {
211 211
             $sScript = $xDialog->confirm($sPhrase, $sScript, '');
212 212
         }
213
-        elseif($this->sCondition !== null)
213
+        elseif ($this->sCondition !== null)
214 214
         {
215 215
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
216
-            if(($sPhrase))
216
+            if (($sPhrase))
217 217
             {
218 218
                 $xDialog->getAlert()->setReturn(true);
219 219
                 $sScript .= 'else{' . $xDialog->warning($sPhrase) . ';}';
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
                 $aVariables[$sParameterStr] = $sVarName;
152 152
                 $sVars .= "$sVarName=$xParameter;";
153 153
                 $nVarId++;
154
-            }
155
-            else
154
+            } else
156 155
             {
157 156
                 // The value is already defined. The corresponding variable is assigned.
158 157
                 $sVarName = $aVariables[$sParameterStr];
@@ -209,8 +208,7 @@  discard block
 block discarded – undo
209 208
         if($this->sCondition == '__confirm__')
210 209
         {
211 210
             $sScript = $xDialog->confirm($sPhrase, $sScript, '');
212
-        }
213
-        elseif($this->sCondition !== null)
211
+        } elseif($this->sCondition !== null)
214 212
         {
215 213
             $sScript = 'if(' . $this->sCondition . '){' . $sScript . ';}';
216 214
             if(($sPhrase))
Please login to merge, or discard this patch.