Passed
Push — v5.x ( 8eee51...080647 )
by Thierry
10:22
created
src/Plugin/Response/JQuery/JQueryPlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
     public function selector(string $sPath = '', $xContext = null): DomSelector
76 76
     {
77 77
         $xSelector = new DomSelector($sPath, $xContext);
78
-        if($this->bCommand && $this->response() !== null)
78
+        if ($this->bCommand && $this->response() !== null)
79 79
         {
80 80
             $this->addCommand('jquery', ['selector' => $xSelector]);
81 81
         }
Please login to merge, or discard this patch.
src/Plugin/Response/JQuery/DomSelector.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function __call(string $sMethod, array $aArguments)
101 101
     {
102
-        if(count($aArguments) === 1)
102
+        if (count($aArguments) === 1)
103 103
         {
104 104
             // If the only parameter is a selector, and the first call
105 105
             // on that selector is a method, then the selector is a callback.
106 106
             $xArgument = $aArguments[0];
107
-            if(is_a($xArgument, self::class) && $xArgument->bIsCallback === null &&
107
+            if (is_a($xArgument, self::class) && $xArgument->bIsCallback === null &&
108 108
                 count($xArgument->aCalls) > 0 && is_a($xArgument->aCalls[0], JsCall::class))
109 109
             {
110 110
                 $xArgument->bIsCallback = true;
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
      */
175 175
     private function selectCalls()
176 176
     {
177
-        if(!$this->sPath)
177
+        if (!$this->sPath)
178 178
         {
179 179
             // If an empty selector is given, use the event target instead
180 180
             return [['_type' => 'select', '_name' => 'this']];
181 181
         }
182
-        if(!$this->xContext)
182
+        if (!$this->xContext)
183 183
         {
184 184
             return [['_type' => 'select', '_name' => $this->sPath]];
185 185
         }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
      */
196 196
     private function makeCallsArray($xParam): array
197 197
     {
198
-        if(!is_a($xParam, Method::class))
198
+        if (!is_a($xParam, Method::class))
199 199
         {
200 200
             // Return an array of array.
201 201
             return [$xParam->jsonSerialize()];
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
     public function toArray(): array
214 214
     {
215 215
         $aCalls = $this->selectCalls();
216
-        foreach($this->aCalls as $xCall)
216
+        foreach ($this->aCalls as $xCall)
217 217
         {
218 218
             $aCalls = array_merge($aCalls, $this->makeCallsArray($xCall));
219 219
         }
220
-        if($this->bToInt)
220
+        if ($this->bToInt)
221 221
         {
222 222
             $aCalls[] = [
223 223
                 '_type' => 'func',
224 224
                 '_name' => 'jaxon.utils.string.toInt',
225 225
                 'params' => [
226
-                    [ '_type' => '_', '_name' => 'this' ],
226
+                    ['_type' => '_', '_name' => 'this'],
227 227
                 ],
228 228
             ];
229 229
         }
Please login to merge, or discard this patch.
src/Plugin/Response/DataBag/DataBagPlugin.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     private function initDataBag()
41 41
     {
42
-        if($this->xDataBag !== null)
42
+        if ($this->xDataBag !== null)
43 43
         {
44 44
             return;
45 45
         }
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
         $aBody = $xRequest->getParsedBody();
49 49
         $aParams = $xRequest->getQueryParams();
50 50
         $aData = is_array($aBody) ?
51
-            $this->readData($aBody['jxnbags'] ?? []) :
52
-            $this->readData($aParams['jxnbags'] ?? []);
51
+            $this->readData($aBody['jxnbags'] ?? []) : $this->readData($aParams['jxnbags'] ?? []);
53 52
         $this->xDataBag = new DataBag($aData);
54 53
     }
55 54
 
@@ -70,8 +69,7 @@  discard block
 block discarded – undo
70 69
     {
71 70
         // Todo: clean input data.
72 71
         return is_string($xData) ?
73
-            (json_decode($xData, true) ?: []) :
74
-            (is_array($xData) ? $xData : []);
72
+            (json_decode($xData, true) ?: []) : (is_array($xData) ? $xData : []);
75 73
     }
76 74
 
77 75
     /**
@@ -89,7 +87,7 @@  discard block
 block discarded – undo
89 87
     public function writeCommand()
90 88
     {
91 89
         $this->initDataBag();
92
-        if($this->xDataBag->touched())
90
+        if ($this->xDataBag->touched())
93 91
         {
94 92
             $this->addCommand('bags.set', ['bags' => $this->xDataBag]);
95 93
         }
Please login to merge, or discard this patch.
src/Plugin/Response/Pagination/PaginatorPlugin.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -131,18 +131,18 @@
 block discarded – undo
131 131
     public function render(Paginator $xPaginator, Call $xCall, string $sWrapperId = '')
132 132
     {
133 133
         $aPages = $xPaginator->pages();
134
-        if(count($aPages) === 0)
134
+        if (count($aPages) === 0)
135 135
         {
136 136
             return;
137 137
         }
138 138
         $xStore = $this->_render($aPages);
139
-        if(!$xStore)
139
+        if (!$xStore)
140 140
         {
141 141
             return;
142 142
         }
143 143
 
144 144
         // Append the page number to the parameter list, if not yet given.
145
-        if(!$xCall->hasPageNumber())
145
+        if (!$xCall->hasPageNumber())
146 146
         {
147 147
             $xCall->addParameter(Parameter::PAGE_NUMBER, 0);
148 148
         }
Please login to merge, or discard this patch.
src/Plugin/ResponsePlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@
 block discarded – undo
71 71
      *
72 72
      * @return void
73 73
      */
74
-    public function addCommand(string $sName, array|JsonSerializable $aOptions)
74
+    public function addCommand(string $sName, array | JsonSerializable $aOptions)
75 75
     {
76 76
         $this->xResponse->addPluginCommand($this, $sName, $aOptions);
77 77
     }
Please login to merge, or discard this patch.
src/Response/Response.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -86,8 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getOutput(): string
88 88
     {
89
-        return $this->getCommandCount() === 0 ? '{}' :
90
-            json_encode(['jxnobj' => $this->aCommands]);
89
+        return $this->getCommandCount() === 0 ? '{}' : json_encode(['jxnobj' => $this->aCommands]);
91 90
     }
92 91
 
93 92
     /**
@@ -189,7 +188,7 @@  discard block
 block discarded – undo
189 188
     public function toPsr(): PsrResponseInterface
190 189
     {
191 190
         $xPsrResponse = $this->xPsr17Factory->createResponse(200);
192
-        if($this->xRequest->getMethod() === 'GET')
191
+        if ($this->xRequest->getMethod() === 'GET')
193 192
         {
194 193
             $xPsrResponse = $xPsrResponse
195 194
                 ->withHeader('Expires', 'Mon, 26 Jul 1997 05:00:00 GMT')
Please login to merge, or discard this patch.
src/Response/Traits/CommandTrait.php 1 patch
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,8 +61,7 @@  discard block
 block discarded – undo
61 61
     public function appendCommands(array $aCommands, bool $bBefore = false)
62 62
     {
63 63
         $this->aCommands = ($bBefore) ?
64
-            array_merge($aCommands, $this->aCommands) :
65
-            array_merge($this->aCommands, $aCommands);
64
+            array_merge($aCommands, $this->aCommands) : array_merge($this->aCommands, $aCommands);
66 65
     }
67 66
 
68 67
     /**
@@ -86,7 +85,7 @@  discard block
 block discarded – undo
86 85
      *
87 86
      * @return ResponseInterface
88 87
      */
89
-    public function addCommand(string $sName, array|JsonSerializable $aOptions): ResponseInterface
88
+    public function addCommand(string $sName, array | JsonSerializable $aOptions): ResponseInterface
90 89
     {
91 90
         $this->aCommands[] = [
92 91
             'cmd' => $this->str($sName),
@@ -105,7 +104,7 @@  discard block
 block discarded – undo
105 104
      * @return ResponseInterface
106 105
      */
107 106
     public function addPluginCommand(ResponsePlugin $xPlugin, string $sName,
108
-        array|JsonSerializable $aOptions): ResponseInterface
107
+        array | JsonSerializable $aOptions): ResponseInterface
109 108
     {
110 109
         $this->aCommands[] = [
111 110
             'cmd' => $this->str($sName),
@@ -124,7 +123,7 @@  discard block
 block discarded – undo
124 123
      */
125 124
     protected function str($xData): string
126 125
     {
127
-        return trim((string)$xData, " \t\n");
126
+        return trim((string) $xData, " \t\n");
128 127
     }
129 128
 
130 129
     /**
@@ -136,10 +135,10 @@  discard block
 block discarded – undo
136 135
      *
137 136
      * @return ResponseInterface
138 137
      */
139
-    protected function _addCommand(string $sName, array|JsonSerializable $aOptions,
138
+    protected function _addCommand(string $sName, array | JsonSerializable $aOptions,
140 139
         bool $bRemoveEmpty = false): ResponseInterface
141 140
     {
142
-        if($bRemoveEmpty)
141
+        if ($bRemoveEmpty)
143 142
         {
144 143
             $aOptions = array_filter($aOptions, function($xOption) {
145 144
                 return $xOption === '';
Please login to merge, or discard this patch.
src/Response/Traits/ScriptTrait.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@
 block discarded – undo
20 20
 
21 21
 trait ScriptTrait
22 22
 {
23
-     /**
24
-     * Add a response command to the array of commands that will be sent to the browser
25
-     *
26
-     * @param string $sName    The command name
27
-     * @param array|JsonSerializable $aOptions    The command options
28
-     *
29
-     * @return ResponseInterface
30
-     */
23
+        /**
24
+         * Add a response command to the array of commands that will be sent to the browser
25
+         *
26
+         * @param string $sName    The command name
27
+         * @param array|JsonSerializable $aOptions    The command options
28
+         *
29
+         * @return ResponseInterface
30
+         */
31 31
     abstract public function addCommand(string $sName, array|JsonSerializable $aOptions): ResponseInterface;
32 32
 
33 33
     /**
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return ResponseInterface
30 30
      */
31
-    abstract public function addCommand(string $sName, array|JsonSerializable $aOptions): ResponseInterface;
31
+    abstract public function addCommand(string $sName, array | JsonSerializable $aOptions): ResponseInterface;
32 32
 
33 33
     /**
34 34
      * Response command that prompts user with [ok] [cancel] style message box
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $aArgs = func_get_args();
62 62
         array_shift($aArgs);
63
-        return $this->addCommand('jc', ['func' => $this->str($sFunc),'args' => $aArgs]);
63
+        return $this->addCommand('jc', ['func' => $this->str($sFunc), 'args' => $aArgs]);
64 64
     }
65 65
 
66 66
     /**
Please login to merge, or discard this patch.
src/Response/ResponseInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      * @return ResponseInterface
74 74
      */
75 75
     public function addPluginCommand(ResponsePlugin $xPlugin, string $sName,
76
-        array|JsonSerializable $aOptions): ResponseInterface;
76
+        array | JsonSerializable $aOptions): ResponseInterface;
77 77
 
78 78
     /**
79 79
      * Convert this response to a PSR7 response object
Please login to merge, or discard this patch.