Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-core/src/Response/AbstractResponse.php 1 patch
Switch Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -30,68 +30,68 @@  discard block
 block discarded – undo
30 30
 
31 31
 abstract class AbstractResponse
32 32
 {
33
-    /**
33
+/**
34 34
      * @var ResponseManager
35 35
      */
36
-    protected $xManager;
36
+protected $xManager;
37 37
 
38
-    /**
38
+/**
39 39
      * @var PluginManager
40 40
      */
41
-    protected $xPluginManager;
41
+protected $xPluginManager;
42 42
 
43
-    /**
43
+/**
44 44
      * The constructor
45 45
      *
46 46
      * @param ResponseManager $xManager
47 47
      * @param PluginManager $xPluginManager
48 48
      */
49
-    public function __construct(ResponseManager $xManager, PluginManager $xPluginManager)
50
-    {
51
-        $this->xManager = $xManager;
52
-        $this->xPluginManager = $xPluginManager;
53
-    }
49
+public function __construct(ResponseManager $xManager, PluginManager $xPluginManager)
50
+{
51
+$this->xManager = $xManager;
52
+$this->xPluginManager = $xPluginManager;
53
+}
54 54
 
55
-    /**
55
+/**
56 56
      * @inheritDoc
57 57
      */
58
-    abstract public function getContentType(): string;
58
+abstract public function getContentType(): string;
59 59
 
60
-    /**
60
+/**
61 61
      * @inheritDoc
62 62
      */
63
-    abstract public function getOutput(): string;
63
+abstract public function getOutput(): string;
64 64
 
65
-    /**
65
+/**
66 66
      * Convert this response to a PSR7 response object
67 67
      *
68 68
      * @return PsrResponseInterface
69 69
      */
70
-    abstract public function toPsr(): PsrResponseInterface;
70
+abstract public function toPsr(): PsrResponseInterface;
71 71
 
72
-    /**
72
+/**
73 73
      * Convert to string
74 74
      *
75 75
      * @param mixed $xData
76 76
      *
77 77
      * @return string
78 78
      */
79
-    protected function str($xData): string
80
-    {
81
-        return $this->xManager->str($xData);
82
-    }
79
+protected function str($xData): string
80
+{
81
+return $this->xManager->str($xData);
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * Get the error message
86 86
      *
87 87
      * @return string
88 88
      */
89
-    public function getErrorMessage(): string
90
-    {
91
-        return $this->xManager->getErrorMessage();
92
-    }
89
+public function getErrorMessage(): string
90
+{
91
+return $this->xManager->getErrorMessage();
92
+}
93 93
 
94
-     /**
94
+/**
95 95
      * Add a response command to the array of commands
96 96
      *
97 97
      * @param string $sName    The command name
@@ -100,43 +100,43 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @return Command
102 102
      */
103
-    public function addCommand(string $sName, array|JsonSerializable $aArgs = [],
104
-        bool $bRemoveEmpty = false): Command
105
-    {
106
-        return $this->xManager->addCommand($sName, $aArgs, $bRemoveEmpty);
107
-    }
103
+public function addCommand(string $sName, array|JsonSerializable $aArgs = [],
104
+bool $bRemoveEmpty = false): Command
105
+{
106
+return $this->xManager->addCommand($sName, $aArgs, $bRemoveEmpty);
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Get the commands in the response
111 111
      *
112 112
      * @return array
113 113
      */
114
-    public function getCommands(): array
115
-    {
116
-        return $this->xManager->getCommands();
117
-    }
114
+public function getCommands(): array
115
+{
116
+return $this->xManager->getCommands();
117
+}
118 118
 
119
-    /**
119
+/**
120 120
      * Get the number of commands in the response
121 121
      *
122 122
      * @return int
123 123
      */
124
-    public function getCommandCount(): int
125
-    {
126
-        return $this->xManager->getCommandCount();
127
-    }
124
+public function getCommandCount(): int
125
+{
126
+return $this->xManager->getCommandCount();
127
+}
128 128
 
129
-    /**
129
+/**
130 130
      * Clear all the commands already added to the response
131 131
      *
132 132
      * @return void
133 133
      */
134
-    public function clearCommands(): void
135
-    {
136
-        $this->xManager->clearCommands();
137
-    }
134
+public function clearCommands(): void
135
+{
136
+$this->xManager->clearCommands();
137
+}
138 138
 
139
-    /**
139
+/**
140 140
      * Find a response plugin by name or class name
141 141
      *
142 142
      * @template R of ResponsePluginInterface
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
      *
145 145
      * @return ($sName is class-string ? R|null : ResponsePluginInterface|null)
146 146
      */
147
-    public function plugin(string $sName): ?ResponsePluginInterface
148
-    {
149
-        $xResponsePlugin = $this->xPluginManager->getResponsePlugin($sName);
150
-        return !$xResponsePlugin ? null : $xResponsePlugin->initPlugin($this);
151
-    }
147
+public function plugin(string $sName): ?ResponsePluginInterface
148
+{
149
+$xResponsePlugin = $this->xPluginManager->getResponsePlugin($sName);
150
+return !$xResponsePlugin ? null : $xResponsePlugin->initPlugin($this);
151
+}
152 152
 
153
-    /**
153
+/**
154 154
      * Magic PHP function
155 155
      *
156 156
      * Used to permit plugins to be called as if they were native members of the Response instance.
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @return null|ResponsePluginInterface
161 161
      */
162
-    public function __get(string $sPluginName)
163
-    {
164
-        return $this->plugin($sPluginName);
165
-    }
162
+public function __get(string $sPluginName)
163
+{
164
+return $this->plugin($sPluginName);
165
+}
166 166
 }
Please login to merge, or discard this patch.
jaxon-core/src/Response/Response.php 1 patch
Switch Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 class Response extends AjaxResponse
28 28
 {
29
-    /**
29
+/**
30 30
      * Add a command to assign the specified value to the given element's attribute
31 31
      *
32 32
      * @param string $sTarget    The id of the html element on the browser
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return self
37 37
      */
38
-    public function assign(string $sTarget, string $sAttribute, string $sValue): self
39
-    {
40
-        $this->xManager->addCommand('node.assign', [
41
-            'id' => $this->str($sTarget),
42
-            'attr' => $this->str($sAttribute),
43
-            'value' => $this->str($sValue),
44
-        ]);
45
-        return $this;
46
-    }
38
+public function assign(string $sTarget, string $sAttribute, string $sValue): self
39
+{
40
+$this->xManager->addCommand('node.assign', [
41
+'id' => $this->str($sTarget),
42
+'attr' => $this->str($sAttribute),
43
+'value' => $this->str($sValue),
44
+]);
45
+return $this;
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * Add a command to assign the specified HTML content to the given element
50 50
      *
51 51
      * This is a shortcut for assign() on the innerHTML attribute.
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return self
57 57
      */
58
-    public function html(string $sTarget, string $sValue): self
59
-    {
60
-        return $this->assign($sTarget, 'innerHTML', $sValue);
61
-    }
58
+public function html(string $sTarget, string $sValue): self
59
+{
60
+return $this->assign($sTarget, 'innerHTML', $sValue);
61
+}
62 62
 
63
-    /**
63
+/**
64 64
      * Add a command to assign the specified value to the given CSS attribute
65 65
      *
66 66
      * @param string $sTarget    The id of the html element on the browser
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return self
71 71
      */
72
-    public function style(string $sTarget, string $sCssAttribute, string $sValue): self
73
-    {
74
-        return $this->assign($sTarget, "style.$sCssAttribute", $sValue);
75
-    }
72
+public function style(string $sTarget, string $sCssAttribute, string $sValue): self
73
+{
74
+return $this->assign($sTarget, "style.$sCssAttribute", $sValue);
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * Add a command to append the specified data to the given element's attribute
79 79
      *
80 80
      * @param string $sTarget    The id of the element to be updated
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @return self
85 85
      */
86
-    public function append(string $sTarget, string $sAttribute, string $sValue): self
87
-    {
88
-        $this->xManager->addCommand('node.append', [
89
-            'id' => $this->str($sTarget),
90
-            'attr' => $this->str($sAttribute),
91
-            'value' => $this->str($sValue),
92
-        ]);
93
-        return $this;
94
-    }
86
+public function append(string $sTarget, string $sAttribute, string $sValue): self
87
+{
88
+$this->xManager->addCommand('node.append', [
89
+'id' => $this->str($sTarget),
90
+'attr' => $this->str($sAttribute),
91
+'value' => $this->str($sValue),
92
+]);
93
+return $this;
94
+}
95 95
 
96
-    /**
96
+/**
97 97
      * Add a command to prepend the specified data to the given element's attribute
98 98
      *
99 99
      * @param string $sTarget    The id of the element to be updated
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return self
104 104
      */
105
-    public function prepend(string $sTarget, string $sAttribute, string $sValue): self
106
-    {
107
-        $this->xManager->addCommand('node.prepend', [
108
-            'id' => $this->str($sTarget),
109
-            'attr' => $this->str($sAttribute),
110
-            'value' => $this->str($sValue),
111
-        ]);
112
-        return $this;
113
-    }
105
+public function prepend(string $sTarget, string $sAttribute, string $sValue): self
106
+{
107
+$this->xManager->addCommand('node.prepend', [
108
+'id' => $this->str($sTarget),
109
+'attr' => $this->str($sAttribute),
110
+'value' => $this->str($sValue),
111
+]);
112
+return $this;
113
+}
114 114
 
115
-    /**
115
+/**
116 116
      * Add a command to replace a specified value with another value within the given element's attribute
117 117
      *
118 118
      * @param string $sTarget    The id of the element to update
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return self
124 124
      */
125
-    public function replace(string $sTarget, string $sAttribute,
126
-        string $sSearch, string $sReplace): self
127
-    {
128
-        $this->xManager->addCommand('node.replace', [
129
-            'id' => $this->str($sTarget),
130
-            'attr' => $this->str($sAttribute),
131
-            'search' => $this->str($sSearch),
132
-            'replace' => $this->str($sReplace),
133
-        ]);
134
-        return $this;
135
-    }
125
+public function replace(string $sTarget, string $sAttribute,
126
+string $sSearch, string $sReplace): self
127
+{
128
+$this->xManager->addCommand('node.replace', [
129
+'id' => $this->str($sTarget),
130
+'attr' => $this->str($sAttribute),
131
+'search' => $this->str($sSearch),
132
+'replace' => $this->str($sReplace),
133
+]);
134
+return $this;
135
+}
136 136
 
137
-    /**
137
+/**
138 138
      * Add a command to clear the specified attribute of the given element
139 139
      *
140 140
      * @param string $sTarget    The id of the element to be updated.
@@ -142,31 +142,31 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return self
144 144
      */
145
-    public function clear(string $sTarget, string $sAttribute = 'innerHTML'): self
146
-    {
147
-        $this->xManager->addCommand('node.clear', [
148
-            'id' => $this->str($sTarget),
149
-            'attr' => $this->str($sAttribute),
150
-        ]);
151
-        return $this;
152
-    }
145
+public function clear(string $sTarget, string $sAttribute = 'innerHTML'): self
146
+{
147
+$this->xManager->addCommand('node.clear', [
148
+'id' => $this->str($sTarget),
149
+'attr' => $this->str($sAttribute),
150
+]);
151
+return $this;
152
+}
153 153
 
154
-    /**
154
+/**
155 155
      * Add a command to remove an element from the document
156 156
      *
157 157
      * @param string $sTarget    The id of the element to be removed
158 158
      *
159 159
      * @return self
160 160
      */
161
-    public function remove(string $sTarget): self
162
-    {
163
-        $this->xManager->addCommand('node.remove', [
164
-            'id' => $this->str($sTarget),
165
-        ]);
166
-        return $this;
167
-    }
161
+public function remove(string $sTarget): self
162
+{
163
+$this->xManager->addCommand('node.remove', [
164
+'id' => $this->str($sTarget),
165
+]);
166
+return $this;
167
+}
168 168
 
169
-    /**
169
+/**
170 170
      * Add a command to bind an element to a component
171 171
      *
172 172
      * @param string $sTarget   The id of the element
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @return self
177 177
      */
178
-    public function bind(string $sTarget, JxnCall $xCall, string $sItem = ''): self
179
-    {
180
-        $this->xManager->addCommand('node.bind', [
181
-            'id' => $this->str($sTarget),
182
-            'component' => !$sItem ? [
183
-                'name' => $xCall->_class(),
184
-            ] : [
185
-                'name' => $xCall->_class(),
186
-                'item' => $this->str($sItem),
187
-            ],
188
-        ]);
189
-        return $this;
190
-    }
178
+public function bind(string $sTarget, JxnCall $xCall, string $sItem = ''): self
179
+{
180
+$this->xManager->addCommand('node.bind', [
181
+'id' => $this->str($sTarget),
182
+'component' => !$sItem ? [
183
+    'name' => $xCall->_class(),
184
+] : [
185
+    'name' => $xCall->_class(),
186
+    'item' => $this->str($sItem),
187
+],
188
+]);
189
+return $this;
190
+}
191 191
 
192
-    /**
192
+/**
193 193
      * Add a command to create a new element on the browser
194 194
      * @deprecated DOM element creation functions are deprecated
195 195
      *
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
      *
200 200
      * @return self
201 201
      */
202
-    public function create(string $sParent, string $sTag, string $sId): self
203
-    {
204
-        $this->xManager->addCommand('node.create', [
205
-            'id' => $this->str($sParent),
206
-            'tag' => [
207
-                'name' => $this->str($sTag),
208
-                'id' => $this->str($sId),
209
-            ],
210
-        ]);
211
-        return $this;
212
-    }
202
+public function create(string $sParent, string $sTag, string $sId): self
203
+{
204
+$this->xManager->addCommand('node.create', [
205
+'id' => $this->str($sParent),
206
+'tag' => [
207
+    'name' => $this->str($sTag),
208
+    'id' => $this->str($sId),
209
+],
210
+]);
211
+return $this;
212
+}
213 213
 
214
-    /**
214
+/**
215 215
      * Add a command to insert a new element just prior to the specified element
216 216
      * @deprecated DOM element creation functions are deprecated
217 217
      *
@@ -221,19 +221,19 @@  discard block
 block discarded – undo
221 221
      *
222 222
      * @return self
223 223
      */
224
-    public function insertBefore(string $sBefore, string $sTag, string $sId): self
225
-    {
226
-        $this->xManager->addCommand('node.insert.before', [
227
-            'id' => $this->str($sBefore),
228
-            'tag' => [
229
-                'name' => $this->str($sTag),
230
-                'id' => $this->str($sId),
231
-            ],
232
-        ]);
233
-        return $this;
234
-    }
224
+public function insertBefore(string $sBefore, string $sTag, string $sId): self
225
+{
226
+$this->xManager->addCommand('node.insert.before', [
227
+'id' => $this->str($sBefore),
228
+'tag' => [
229
+    'name' => $this->str($sTag),
230
+    'id' => $this->str($sId),
231
+],
232
+]);
233
+return $this;
234
+}
235 235
 
236
-    /**
236
+/**
237 237
      * Add a command to insert a new element just prior to the specified element
238 238
      * This is an alias for insertBefore.
239 239
      * @deprecated DOM element creation functions are deprecated
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @return self
246 246
      */
247
-    public function insert(string $sBefore, string $sTag, string $sId): self
248
-    {
249
-        return $this->insertBefore($sBefore, $sTag, $sId);
250
-    }
247
+public function insert(string $sBefore, string $sTag, string $sId): self
248
+{
249
+return $this->insertBefore($sBefore, $sTag, $sId);
250
+}
251 251
 
252
-    /**
252
+/**
253 253
      * Add a command to insert a new element after the specified
254 254
      * @deprecated DOM element creation functions are deprecated
255 255
      *
@@ -259,19 +259,19 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return self
261 261
      */
262
-    public function insertAfter(string $sAfter, string $sTag, string $sId): self
263
-    {
264
-        $this->xManager->addCommand('node.insert.after', [
265
-            'id' => $this->str($sAfter),
266
-            'tag' => [
267
-                'name' => $this->str($sTag),
268
-                'id' => $this->str($sId),
269
-            ],
270
-        ]);
271
-        return $this;
272
-    }
262
+public function insertAfter(string $sAfter, string $sTag, string $sId): self
263
+{
264
+$this->xManager->addCommand('node.insert.after', [
265
+'id' => $this->str($sAfter),
266
+'tag' => [
267
+    'name' => $this->str($sTag),
268
+    'id' => $this->str($sId),
269
+],
270
+]);
271
+return $this;
272
+}
273 273
 
274
-    /**
274
+/**
275 275
      * Add a command to set an event handler on the specified element
276 276
      * This handler can take custom parameters, and is is executed in a specific context.
277 277
      * @deprecated Event handler functions are deprecated
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
      *
283 283
      * @return self
284 284
      */
285
-    public function setEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
286
-    {
287
-        $this->xManager->addCommand('handler.event.set', [
288
-            'id' => $this->str($sTarget),
289
-            'event' => $this->str($sEvent),
290
-            'func' => $xCall,
291
-        ]);
292
-        return $this;
293
-    }
285
+public function setEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
286
+{
287
+$this->xManager->addCommand('handler.event.set', [
288
+'id' => $this->str($sTarget),
289
+'event' => $this->str($sEvent),
290
+'func' => $xCall,
291
+]);
292
+return $this;
293
+}
294 294
 
295
-    /**
295
+/**
296 296
      * Add a command to set a click handler on the browser
297 297
      * @deprecated Event handler functions are deprecated
298 298
      *
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
      *
302 302
      * @return self
303 303
      */
304
-    public function onClick(string $sTarget, JsExpr $xCall): self
305
-    {
306
-        return $this->setEventHandler($sTarget, 'onclick', $xCall);
307
-    }
304
+public function onClick(string $sTarget, JsExpr $xCall): self
305
+{
306
+return $this->setEventHandler($sTarget, 'onclick', $xCall);
307
+}
308 308
 
309
-    /**
309
+/**
310 310
      * Add a command to add an event handler on the specified element
311 311
      * This handler can take custom parameters, and is is executed in a specific context.
312 312
      * @deprecated Event handler functions are deprecated
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
      *
318 318
      * @return self
319 319
      */
320
-    public function addEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
321
-    {
322
-        $this->xManager->addCommand('handler.event.add', [
323
-            'id' => $this->str($sTarget),
324
-            'event' => $this->str($sEvent),
325
-            'func' => $xCall,
326
-        ]);
327
-        return $this;
328
-    }
320
+public function addEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
321
+{
322
+$this->xManager->addCommand('handler.event.add', [
323
+'id' => $this->str($sTarget),
324
+'event' => $this->str($sEvent),
325
+'func' => $xCall,
326
+]);
327
+return $this;
328
+}
329 329
 
330
-    /**
330
+/**
331 331
      * Add a command to install an event handler on the specified element
332 332
      * You can add more than one event handler to an element's event using this method.
333 333
      * @deprecated Event handler functions are deprecated
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
      *
339 339
      * @return self
340 340
      */
341
-    public function addHandler(string $sTarget, string $sEvent, string $sHandler): self
342
-    {
343
-        $this->xManager->addCommand('handler.add', [
344
-            'id' => $this->str($sTarget),
345
-            'event' => $this->str($sEvent),
346
-            'func' => $this->str($sHandler),
347
-        ]);
348
-        return $this;
349
-    }
341
+public function addHandler(string $sTarget, string $sEvent, string $sHandler): self
342
+{
343
+$this->xManager->addCommand('handler.add', [
344
+'id' => $this->str($sTarget),
345
+'event' => $this->str($sEvent),
346
+'func' => $this->str($sHandler),
347
+]);
348
+return $this;
349
+}
350 350
 
351
-    /**
351
+/**
352 352
      * Add a command to remove an event handler from an element
353 353
      * @deprecated Event handler functions are deprecated
354 354
      *
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
      *
359 359
      * @return self
360 360
      */
361
-    public function removeHandler(string $sTarget, string $sEvent, string $sHandler): self
362
-    {
363
-        $this->xManager->addCommand('handler.remove', [
364
-            'id' => $this->str($sTarget),
365
-            'event' => $this->str($sEvent),
366
-            'func' => $this->str($sHandler),
367
-        ]);
368
-        return $this;
369
-    }
361
+public function removeHandler(string $sTarget, string $sEvent, string $sHandler): self
362
+{
363
+$this->xManager->addCommand('handler.remove', [
364
+'id' => $this->str($sTarget),
365
+'event' => $this->str($sEvent),
366
+'func' => $this->str($sHandler),
367
+]);
368
+return $this;
369
+}
370 370
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/AbstractResponsePlugin.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
 
28 28
 abstract class AbstractResponsePlugin extends AbstractPlugin implements ResponsePluginInterface
29 29
 {
30
-    use ResponsePluginTrait;
30
+use ResponsePluginTrait;
31 31
 
32
-    /**
32
+/**
33 33
      * Initialize the plugin
34 34
      *
35 35
      * @return void
36 36
      */
37
-    protected function init(): void
38
-    {}
37
+protected function init(): void
38
+{}
39 39
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/PluginInterface.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 interface PluginInterface
6 6
 {
7
-    /**
7
+/**
8 8
      * Get a unique name to identify the plugin.
9 9
      *
10 10
      * @return string
11 11
      */
12
-    public function getName(): string;
12
+public function getName(): string;
13 13
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/Handler/CallbackManager.php 1 patch
Switch Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -26,144 +26,144 @@  discard block
 block discarded – undo
26 26
 
27 27
 class CallbackManager
28 28
 {
29
-    /**
29
+/**
30 30
      * The callbacks to run after booting the library
31 31
      *
32 32
      * @var callable[]
33 33
      */
34
-    protected $aBootCallbacks = [];
34
+protected $aBootCallbacks = [];
35 35
 
36
-    /**
36
+/**
37 37
      * The callbacks to run before processing the request
38 38
      *
39 39
      * @var callable[]
40 40
      */
41
-    protected $aBeforeCallbacks = [];
41
+protected $aBeforeCallbacks = [];
42 42
 
43
-    /**
43
+/**
44 44
      * The callbacks to run after processing the request
45 45
      *
46 46
      * @var callable[]
47 47
      */
48
-    protected $aAfterCallbacks = [];
48
+protected $aAfterCallbacks = [];
49 49
 
50
-    /**
50
+/**
51 51
      * The callbacks to run in case of invalid request
52 52
      *
53 53
      * @var callable[]
54 54
      */
55
-    protected $aInvalidCallbacks = [];
55
+protected $aInvalidCallbacks = [];
56 56
 
57
-    /**
57
+/**
58 58
      * The callbacks to run in case of error
59 59
      *
60 60
      * @var callable[]
61 61
      */
62
-    protected $aErrorCallbacks = [];
62
+protected $aErrorCallbacks = [];
63 63
 
64
-    /**
64
+/**
65 65
      * The callbacks to run in case of exception
66 66
      *
67 67
      * @var callable[][]
68 68
      */
69
-    protected $aExceptionCallbacks = [];
69
+protected $aExceptionCallbacks = [];
70 70
 
71
-    /**
71
+/**
72 72
      * The callbacks to run when a class is instanced
73 73
      *
74 74
      * @var callable[]
75 75
      */
76
-    protected $aInitCallbacks = [];
76
+protected $aInitCallbacks = [];
77 77
 
78
-    /**
78
+/**
79 79
      * Get the library booting callbacks, and reset the array.
80 80
      *
81 81
      * @return callable[]
82 82
      */
83
-    public function popBootCallbacks(): array
84
-    {
85
-        if(empty($this->aBootCallbacks))
86
-        {
87
-            return [];
88
-        }
89
-        $aCallbacks = $this->aBootCallbacks;
90
-        $this->aBootCallbacks = [];
91
-        return $aCallbacks;
92
-    }
83
+public function popBootCallbacks(): array
84
+{
85
+if(empty($this->aBootCallbacks))
86
+{
87
+return [];
88
+}
89
+$aCallbacks = $this->aBootCallbacks;
90
+$this->aBootCallbacks = [];
91
+return $aCallbacks;
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Get the exception callbacks.
96 96
      *
97 97
      * @param Exception $xException      The exception class
98 98
      *
99 99
      * @return callable[]
100 100
      */
101
-    private function getExceptionCallbacks(Exception $xException): array
102
-    {
103
-        $aExceptionCallbacks = [];
104
-        foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks)
105
-        {
106
-            if(is_a($xException, $sExClass))
107
-            {
108
-                $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks);
109
-            }
110
-        }
111
-        return array_values($aExceptionCallbacks);
112
-    }
101
+private function getExceptionCallbacks(Exception $xException): array
102
+{
103
+$aExceptionCallbacks = [];
104
+foreach($this->aExceptionCallbacks as $sExClass => $aCallbacks)
105
+{
106
+if(is_a($xException, $sExClass))
107
+{
108
+    $aExceptionCallbacks = array_merge($aExceptionCallbacks, $aCallbacks);
109
+}
110
+}
111
+return array_values($aExceptionCallbacks);
112
+}
113 113
 
114
-    /**
114
+/**
115 115
      * Add a library booting callback.
116 116
      *
117 117
      * @param callable $xCallable    The callback function
118 118
      *
119 119
      * @return CallbackManager
120 120
      */
121
-    public function boot(callable $xCallable): CallbackManager
122
-    {
123
-        $this->aBootCallbacks[] = $xCallable;
124
-        return $this;
125
-    }
121
+public function boot(callable $xCallable): CallbackManager
122
+{
123
+$this->aBootCallbacks[] = $xCallable;
124
+return $this;
125
+}
126 126
 
127
-    /**
127
+/**
128 128
      * Add a pre-request processing callback.
129 129
      *
130 130
      * @param callable $xCallable    The callback function
131 131
      *
132 132
      * @return CallbackManager
133 133
      */
134
-    public function before(callable $xCallable): CallbackManager
135
-    {
136
-        $this->aBeforeCallbacks[] = $xCallable;
137
-        return $this;
138
-    }
134
+public function before(callable $xCallable): CallbackManager
135
+{
136
+$this->aBeforeCallbacks[] = $xCallable;
137
+return $this;
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * Add a post-request processing callback.
142 142
      *
143 143
      * @param callable $xCallable    The callback function
144 144
      *
145 145
      * @return CallbackManager
146 146
      */
147
-    public function after(callable $xCallable): CallbackManager
148
-    {
149
-        $this->aAfterCallbacks[] = $xCallable;
150
-        return $this;
151
-    }
147
+public function after(callable $xCallable): CallbackManager
148
+{
149
+$this->aAfterCallbacks[] = $xCallable;
150
+return $this;
151
+}
152 152
 
153
-    /**
153
+/**
154 154
      * Add a invalid request callback.
155 155
      *
156 156
      * @param callable $xCallable    The callback function
157 157
      *
158 158
      * @return CallbackManager
159 159
      */
160
-    public function invalid(callable $xCallable): CallbackManager
161
-    {
162
-        $this->aInvalidCallbacks[] = $xCallable;
163
-        return $this;
164
-    }
160
+public function invalid(callable $xCallable): CallbackManager
161
+{
162
+$this->aInvalidCallbacks[] = $xCallable;
163
+return $this;
164
+}
165 165
 
166
-    /**
166
+/**
167 167
      * Add a processing error callback.
168 168
      *
169 169
      * @param callable $xCallable   The callback function
@@ -171,74 +171,74 @@  discard block
 block discarded – undo
171 171
      *
172 172
      * @return CallbackManager
173 173
      */
174
-    public function error(callable $xCallable, string $sExClass = ''): CallbackManager
175
-    {
176
-        if($sExClass === '' || $sExClass === Exception::class)
177
-        {
178
-            $this->aErrorCallbacks[] = $xCallable;
179
-            return $this;
180
-        }
181
-        // Callback for a given exception class
182
-        if(isset($this->aExceptionCallbacks[$sExClass]))
183
-        {
184
-            $this->aExceptionCallbacks[$sExClass][] = $xCallable;
185
-            return $this;
186
-        }
187
-        $this->aExceptionCallbacks[$sExClass] = [$xCallable];
188
-        return $this;
189
-    }
174
+public function error(callable $xCallable, string $sExClass = ''): CallbackManager
175
+{
176
+if($sExClass === '' || $sExClass === Exception::class)
177
+{
178
+$this->aErrorCallbacks[] = $xCallable;
179
+return $this;
180
+}
181
+// Callback for a given exception class
182
+if(isset($this->aExceptionCallbacks[$sExClass]))
183
+{
184
+$this->aExceptionCallbacks[$sExClass][] = $xCallable;
185
+return $this;
186
+}
187
+$this->aExceptionCallbacks[$sExClass] = [$xCallable];
188
+return $this;
189
+}
190 190
 
191
-    /**
191
+/**
192 192
      * Add a class initialisation callback.
193 193
      *
194 194
      * @param callable $xCallable    The callback function
195 195
      *
196 196
      * @return CallbackManager
197 197
      */
198
-    public function init(callable $xCallable): CallbackManager
199
-    {
200
-        $this->aInitCallbacks[] = $xCallable;
201
-        return $this;
202
-    }
198
+public function init(callable $xCallable): CallbackManager
199
+{
200
+$this->aInitCallbacks[] = $xCallable;
201
+return $this;
202
+}
203 203
 
204
-    /**
204
+/**
205 205
      * @param callable $xCallback
206 206
      * @param array $aParameters
207 207
      *
208 208
      * @return void
209 209
      */
210
-    private function executeCallback(callable $xCallback, array $aParameters): void
211
-    {
212
-        call_user_func_array($xCallback, $aParameters);
213
-    }
210
+private function executeCallback(callable $xCallback, array $aParameters): void
211
+{
212
+call_user_func_array($xCallback, $aParameters);
213
+}
214 214
 
215
-    /**
215
+/**
216 216
      * @param array $aCallbacks
217 217
      * @param array $aParameters
218 218
      *
219 219
      * @return void
220 220
      */
221
-    private function executeCallbacks(array $aCallbacks, array $aParameters): void
222
-    {
223
-        foreach($aCallbacks as $xCallback)
224
-        {
225
-            $this->executeCallback($xCallback, $aParameters);
226
-        }
227
-    }
221
+private function executeCallbacks(array $aCallbacks, array $aParameters): void
222
+{
223
+foreach($aCallbacks as $xCallback)
224
+{
225
+$this->executeCallback($xCallback, $aParameters);
226
+}
227
+}
228 228
 
229
-    /**
229
+/**
230 230
      * Execute the class initialisation callbacks.
231 231
      *
232 232
      * @param mixed $xComponent
233 233
      *
234 234
      * @return void
235 235
      */
236
-    public function onInit($xComponent): void
237
-    {
238
-        $this->executeCallbacks($this->aInitCallbacks, [$xComponent]);
239
-    }
236
+public function onInit($xComponent): void
237
+{
238
+$this->executeCallbacks($this->aInitCallbacks, [$xComponent]);
239
+}
240 240
 
241
-    /**
241
+/**
242 242
      * These are the pre-request processing callbacks passed to the Jaxon library.
243 243
      *
244 244
      * @param Target $xTarget
@@ -247,20 +247,20 @@  discard block
 block discarded – undo
247 247
      * @return void
248 248
      * @throws RequestException
249 249
      */
250
-    public function onBefore(Target $xTarget, bool &$bEndRequest): void
251
-    {
252
-        // Call the user defined callback
253
-        foreach($this->aBeforeCallbacks as $xCallback)
254
-        {
255
-            $this->executeCallback($xCallback, [$xTarget, &$bEndRequest]);
256
-            if($bEndRequest)
257
-            {
258
-                return;
259
-            }
260
-        }
261
-    }
250
+public function onBefore(Target $xTarget, bool &$bEndRequest): void
251
+{
252
+// Call the user defined callback
253
+foreach($this->aBeforeCallbacks as $xCallback)
254
+{
255
+$this->executeCallback($xCallback, [$xTarget, &$bEndRequest]);
256
+if($bEndRequest)
257
+{
258
+    return;
259
+}
260
+}
261
+}
262 262
 
263
-    /**
263
+/**
264 264
      * These are the post-request processing callbacks passed to the Jaxon library.
265 265
      *
266 266
      * @param Target $xTarget
@@ -269,12 +269,12 @@  discard block
 block discarded – undo
269 269
      * @return void
270 270
      * @throws RequestException
271 271
      */
272
-    public function onAfter(Target $xTarget, bool $bEndRequest): void
273
-    {
274
-        $this->executeCallbacks($this->aAfterCallbacks, [$xTarget, $bEndRequest]);
275
-    }
272
+public function onAfter(Target $xTarget, bool $bEndRequest): void
273
+{
274
+$this->executeCallbacks($this->aAfterCallbacks, [$xTarget, $bEndRequest]);
275
+}
276 276
 
277
-    /**
277
+/**
278 278
      * These callbacks are called whenever an invalid request is processed.
279 279
      *
280 280
      * @param RequestException $xException
@@ -282,13 +282,13 @@  discard block
 block discarded – undo
282 282
      * @return void
283 283
      * @throws RequestException
284 284
      */
285
-    public function onInvalid(RequestException $xException): void
286
-    {
287
-        $this->executeCallbacks($this->aInvalidCallbacks, [$xException]);
288
-        throw $xException;
289
-    }
285
+public function onInvalid(RequestException $xException): void
286
+{
287
+$this->executeCallbacks($this->aInvalidCallbacks, [$xException]);
288
+throw $xException;
289
+}
290 290
 
291
-    /**
291
+/**
292 292
      * These callbacks are called whenever an invalid request is processed.
293 293
      *
294 294
      * @param Exception $xException
@@ -296,17 +296,17 @@  discard block
 block discarded – undo
296 296
      * @return void
297 297
      * @throws Exception
298 298
      */
299
-    public function onError(Exception $xException): void
300
-    {
301
-        $aExceptionCallbacks = $this->getExceptionCallbacks($xException);
302
-        $this->executeCallbacks($aExceptionCallbacks, [$xException]);
303
-        if(count($aExceptionCallbacks) > 0)
304
-        {
305
-            // Do not throw the exception if a custom handler is defined
306
-            return;
307
-        }
299
+public function onError(Exception $xException): void
300
+{
301
+$aExceptionCallbacks = $this->getExceptionCallbacks($xException);
302
+$this->executeCallbacks($aExceptionCallbacks, [$xException]);
303
+if(count($aExceptionCallbacks) > 0)
304
+{
305
+// Do not throw the exception if a custom handler is defined
306
+return;
307
+}
308 308
 
309
-        $this->executeCallbacks($this->aErrorCallbacks, [$xException]);
310
-        throw $xException;
311
-    }
309
+$this->executeCallbacks($this->aErrorCallbacks, [$xException]);
310
+throw $xException;
311
+}
312 312
 }
Please login to merge, or discard this patch.
jaxon-core/src/Script/ParameterFactory.php 1 patch
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,109 +19,109 @@
 block discarded – undo
19 19
 
20 20
 class ParameterFactory
21 21
 {
22
-    /**
22
+/**
23 23
      * Make a parameter of type form values
24 24
      *
25 25
      * @param string $sFormId    The id of the HTML form
26 26
      *
27 27
      * @return array
28 28
      */
29
-    public function form(string $sFormId): array
30
-    {
31
-        return (new HtmlReader($sFormId))->form();
32
-    }
29
+public function form(string $sFormId): array
30
+{
31
+return (new HtmlReader($sFormId))->form();
32
+}
33 33
 
34
-    /**
34
+/**
35 35
      * Make a parameter of type input value
36 36
      *
37 37
      * @param string $sInputId    the id of the HTML input element
38 38
      *
39 39
      * @return TypedValue
40 40
      */
41
-    public function input(string $sInputId): TypedValue
42
-    {
43
-        return (new HtmlReader($sInputId))->input();
44
-    }
41
+public function input(string $sInputId): TypedValue
42
+{
43
+return (new HtmlReader($sInputId))->input();
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * Make a parameter of type checked value
48 48
      *
49 49
      * @param string $sInputId    the name of the HTML form element
50 50
      *
51 51
      * @return array
52 52
      */
53
-    public function checked(string $sInputId): array
54
-    {
55
-        return (new HtmlReader($sInputId))->checked();
56
-    }
53
+public function checked(string $sInputId): array
54
+{
55
+return (new HtmlReader($sInputId))->checked();
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * Make a parameter of type select
60 60
      *
61 61
      * @param string $sInputId    the name of the HTML form element
62 62
      *
63 63
      * @return TypedValue
64 64
      */
65
-    public function select(string $sInputId): TypedValue
66
-    {
67
-        return $this->input($sInputId);
68
-    }
65
+public function select(string $sInputId): TypedValue
66
+{
67
+return $this->input($sInputId);
68
+}
69 69
 
70
-    /**
70
+/**
71 71
      * Make a parameter of type inner html
72 72
      *
73 73
      * @param string $sElementId    the id of the HTML element
74 74
      *
75 75
      * @return TypedValue
76 76
      */
77
-    public function html(string $sElementId): TypedValue
78
-    {
79
-        return (new HtmlReader($sElementId))->html();
80
-    }
77
+public function html(string $sElementId): TypedValue
78
+{
79
+return (new HtmlReader($sElementId))->html();
80
+}
81 81
 
82
-    /**
82
+/**
83 83
      * Make a parameter of type quoted string
84 84
      *
85 85
      * @param string $sValue    the value of the parameter
86 86
      *
87 87
      * @return TypedValue
88 88
      */
89
-    public function string(string $sValue): TypedValue
90
-    {
91
-        return TypedValue::make($sValue);
92
-    }
89
+public function string(string $sValue): TypedValue
90
+{
91
+return TypedValue::make($sValue);
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Make a parameter of type numeric
96 96
      *
97 97
      * @param int $nValue    the value of the parameter
98 98
      *
99 99
      * @return TypedValue
100 100
      */
101
-    public function numeric(int $nValue): TypedValue
102
-    {
103
-        return TypedValue::make($nValue);
104
-    }
101
+public function numeric(int $nValue): TypedValue
102
+{
103
+return TypedValue::make($nValue);
104
+}
105 105
 
106
-    /**
106
+/**
107 107
      * Make a parameter of type numeric
108 108
      *
109 109
      * @param int $nValue    the value of the parameter
110 110
      *
111 111
      * @return TypedValue
112 112
      */
113
-    public function int(int $nValue): TypedValue
114
-    {
115
-        return $this->numeric($nValue);
116
-    }
113
+public function int(int $nValue): TypedValue
114
+{
115
+return $this->numeric($nValue);
116
+}
117 117
 
118
-    /**
118
+/**
119 119
      * Make a parameter of type page number
120 120
      *
121 121
      * @return TypedValue
122 122
      */
123
-    public function page(): TypedValue
124
-    {
125
-        return TypedValue::page();
126
-    }
123
+public function page(): TypedValue
124
+{
125
+return TypedValue::page();
126
+}
127 127
 }
Please login to merge, or discard this patch.
jaxon-core/src/Script/JsExpr.php 1 patch
Switch Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -29,77 +29,77 @@  discard block
 block discarded – undo
29 29
 
30 30
 class JsExpr extends TypedValue implements Stringable
31 31
 {
32
-    /**
32
+/**
33 33
      * The actions to be applied on the selected element
34 34
      *
35 35
      * @var array
36 36
      */
37
-    protected $aCalls = [];
37
+protected $aCalls = [];
38 38
 
39
-    /**
39
+/**
40 40
      * The arguments of the else() calls
41 41
      *
42 42
      * @var array
43 43
      */
44
-    protected $aAlert = [];
44
+protected $aAlert = [];
45 45
 
46
-    /**
46
+/**
47 47
      * A condition to check before making the call
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected $aCondition = [];
51
+protected $aCondition = [];
52 52
 
53
-    /**
53
+/**
54 54
      * The arguments of the confirm() call
55 55
      *
56 56
      * @var array
57 57
      */
58
-    protected $aConfirm = [];
58
+protected $aConfirm = [];
59 59
 
60
-    /**
60
+/**
61 61
      * @var DialogCommand
62 62
      */
63
-    private static DialogCommand $xDialogCommand;
63
+private static DialogCommand $xDialogCommand;
64 64
 
65
-    /**
65
+/**
66 66
      * The constructor
67 67
      */
68
-    public function __construct(...$aCalls)
69
-    {
70
-        $this->aCalls = $aCalls;
71
-    }
68
+public function __construct(...$aCalls)
69
+{
70
+$this->aCalls = $aCalls;
71
+}
72 72
 
73
-    /**
73
+/**
74 74
      * Set the dialog command
75 75
      *
76 76
      * @param DialogCommand $xDialogCommand
77 77
      *
78 78
      * @return void
79 79
      */
80
-    public static function setDialogCommand(DialogCommand $xDialogCommand): void
81
-    {
82
-        self::$xDialogCommand = $xDialogCommand;
83
-    }
80
+public static function setDialogCommand(DialogCommand $xDialogCommand): void
81
+{
82
+self::$xDialogCommand = $xDialogCommand;
83
+}
84 84
 
85
-    /**
85
+/**
86 86
      * Get the first function in the calls
87 87
      *
88 88
      * @return Func|null
89 89
      */
90
-    public function func(): ?Func
91
-    {
92
-        foreach($this->aCalls as $xCall)
93
-        {
94
-            if(is_a($xCall, Func::class))
95
-            {
96
-                return $xCall;
97
-            }
98
-        }
99
-        return null;
100
-    }
101
-
102
-    /**
90
+public function func(): ?Func
91
+{
92
+foreach($this->aCalls as $xCall)
93
+{
94
+if(is_a($xCall, Func::class))
95
+{
96
+    return $xCall;
97
+}
98
+}
99
+return null;
100
+}
101
+
102
+/**
103 103
      * Add a call to a js function on the current object
104 104
      *
105 105
      * @param string  $sMethod
@@ -107,28 +107,28 @@  discard block
 block discarded – undo
107 107
      *
108 108
      * @return self
109 109
      */
110
-    public function __call(string $sMethod, array $aArguments): self
111
-    {
112
-        // Append the action into the array
113
-        $this->aCalls[] = new Func($sMethod, $aArguments);
114
-        return $this;
115
-    }
110
+public function __call(string $sMethod, array $aArguments): self
111
+{
112
+// Append the action into the array
113
+$this->aCalls[] = new Func($sMethod, $aArguments);
114
+return $this;
115
+}
116 116
 
117
-    /**
117
+/**
118 118
      * Get the value of an attribute of the current object
119 119
      *
120 120
      * @param string  $sAttribute
121 121
      *
122 122
      * @return self
123 123
      */
124
-    public function __get(string $sAttribute): self
125
-    {
126
-        // Append the action into the array
127
-        $this->aCalls[] = Attr::get($sAttribute);
128
-        return $this;
129
-    }
124
+public function __get(string $sAttribute): self
125
+{
126
+// Append the action into the array
127
+$this->aCalls[] = Attr::get($sAttribute);
128
+return $this;
129
+}
130 130
 
131
-    /**
131
+/**
132 132
      * Set the value of an attribute of the current object
133 133
      *
134 134
      * @param string $sAttribute
@@ -136,14 +136,14 @@  discard block
 block discarded – undo
136 136
      *
137 137
      * @return void
138 138
      */
139
-    public function __set(string $sAttribute, $xValue)
140
-    {
141
-        // Append the action into the array
142
-        $this->aCalls[] = Attr::set($sAttribute, $xValue);
143
-        return $this;
144
-    }
139
+public function __set(string $sAttribute, $xValue)
140
+{
141
+// Append the action into the array
142
+$this->aCalls[] = Attr::set($sAttribute, $xValue);
143
+return $this;
144
+}
145 145
 
146
-    /**
146
+/**
147 147
      * Set an event handler on the selected elements
148 148
      *
149 149
      * @param string $sMode    The event mode: 'jq' or 'js'
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
      *
153 153
      * @return self
154 154
      */
155
-    public function event(string $sMode, string $sName, JsExpr $xHandler): self
156
-    {
157
-        $this->aCalls[] = new Event($sMode, $sName, $xHandler);
158
-        return $this;
159
-    }
155
+public function event(string $sMode, string $sName, JsExpr $xHandler): self
156
+{
157
+$this->aCalls[] = new Event($sMode, $sName, $xHandler);
158
+return $this;
159
+}
160 160
 
161
-    /**
161
+/**
162 162
      * Show a message if the condition to the call is not met
163 163
      *
164 164
      * @param string $sMessage  The message to show
@@ -166,13 +166,13 @@  discard block
 block discarded – undo
166 166
      *
167 167
      * @return self
168 168
      */
169
-    public function elseShow(string $sMessage, ...$aArgs): self
170
-    {
171
-        $this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs);
172
-        return $this;
173
-    }
169
+public function elseShow(string $sMessage, ...$aArgs): self
170
+{
171
+$this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs);
172
+return $this;
173
+}
174 174
 
175
-    /**
175
+/**
176 176
      * Show an information message if the condition to the call is not met
177 177
      *
178 178
      * @param string $sMessage  The message to show
@@ -180,13 +180,13 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @return self
182 182
      */
183
-    public function elseInfo(string $sMessage, ...$aArgs): self
184
-    {
185
-        $this->aAlert = self::$xDialogCommand->info($sMessage, $aArgs);
186
-        return $this;
187
-    }
183
+public function elseInfo(string $sMessage, ...$aArgs): self
184
+{
185
+$this->aAlert = self::$xDialogCommand->info($sMessage, $aArgs);
186
+return $this;
187
+}
188 188
 
189
-    /**
189
+/**
190 190
      * Show a success message if the condition to the call is not met
191 191
      *
192 192
      * @param string $sMessage  The message to show
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
      *
195 195
      * @return self
196 196
      */
197
-    public function elseSuccess(string $sMessage, ...$aArgs): self
198
-    {
199
-        $this->aAlert = self::$xDialogCommand->success($sMessage, $aArgs);
200
-        return $this;
201
-    }
197
+public function elseSuccess(string $sMessage, ...$aArgs): self
198
+{
199
+$this->aAlert = self::$xDialogCommand->success($sMessage, $aArgs);
200
+return $this;
201
+}
202 202
 
203
-    /**
203
+/**
204 204
      * Show a warning message if the condition to the call is not met
205 205
      *
206 206
      * @param string $sMessage  The message to show
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
      *
209 209
      * @return self
210 210
      */
211
-    public function elseWarning(string $sMessage, ...$aArgs): self
212
-    {
213
-        $this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs);
214
-        return $this;
215
-    }
211
+public function elseWarning(string $sMessage, ...$aArgs): self
212
+{
213
+$this->aAlert = self::$xDialogCommand->warning($sMessage, $aArgs);
214
+return $this;
215
+}
216 216
 
217
-    /**
217
+/**
218 218
      * Show an error message if the condition to the call is not met
219 219
      *
220 220
      * @param string $sMessage  The message to show
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
      *
223 223
      * @return self
224 224
      */
225
-    public function elseError(string $sMessage, ...$aArgs): self
226
-    {
227
-        $this->aAlert = self::$xDialogCommand->error($sMessage, $aArgs);
228
-        return $this;
229
-    }
225
+public function elseError(string $sMessage, ...$aArgs): self
226
+{
227
+$this->aAlert = self::$xDialogCommand->error($sMessage, $aArgs);
228
+return $this;
229
+}
230 230
 
231
-    /**
231
+/**
232 232
      * Add a confirmation question to the request
233 233
      *
234 234
      * @param string $sQuestion The question to ask
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
      *
237 237
      * @return self
238 238
      */
239
-    public function confirm(string $sQuestion, ...$aArgs): self
240
-    {
241
-        $this->aConfirm = self::$xDialogCommand->confirm($sQuestion, $aArgs);
242
-        return $this;
243
-    }
239
+public function confirm(string $sQuestion, ...$aArgs): self
240
+{
241
+$this->aConfirm = self::$xDialogCommand->confirm($sQuestion, $aArgs);
242
+return $this;
243
+}
244 244
 
245
-    /**
245
+/**
246 246
      * Check if a value is equal to another before sending the request
247 247
      *
248 248
      * @param mixed $xValue1    The first value to compare
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
      *
251 251
      * @return self
252 252
      */
253
-    public function ifeq($xValue1, $xValue2): self
254
-    {
255
-        $this->aCondition = ['eq', TypedValue::make($xValue1), TypedValue::make($xValue2)];
256
-        return $this;
257
-    }
253
+public function ifeq($xValue1, $xValue2): self
254
+{
255
+$this->aCondition = ['eq', TypedValue::make($xValue1), TypedValue::make($xValue2)];
256
+return $this;
257
+}
258 258
 
259
-    /**
259
+/**
260 260
      * Check if a value is equal to another before sending the request
261 261
      *
262 262
      * @param mixed $xValue1    The first value to compare
@@ -264,13 +264,13 @@  discard block
 block discarded – undo
264 264
      *
265 265
      * @return self
266 266
      */
267
-    public function ifteq($xValue1, $xValue2): self
268
-    {
269
-        $this->aCondition = ['teq', TypedValue::make($xValue1), TypedValue::make($xValue2)];
270
-        return $this;
271
-    }
267
+public function ifteq($xValue1, $xValue2): self
268
+{
269
+$this->aCondition = ['teq', TypedValue::make($xValue1), TypedValue::make($xValue2)];
270
+return $this;
271
+}
272 272
 
273
-    /**
273
+/**
274 274
      * Check if a value is not equal to another before sending the request
275 275
      *
276 276
      * @param mixed $xValue1    The first value to compare
@@ -278,13 +278,13 @@  discard block
 block discarded – undo
278 278
      *
279 279
      * @return self
280 280
      */
281
-    public function ifne($xValue1, $xValue2): self
282
-    {
283
-        $this->aCondition = ['ne', TypedValue::make($xValue1), TypedValue::make($xValue2)];
284
-        return $this;
285
-    }
281
+public function ifne($xValue1, $xValue2): self
282
+{
283
+$this->aCondition = ['ne', TypedValue::make($xValue1), TypedValue::make($xValue2)];
284
+return $this;
285
+}
286 286
 
287
-    /**
287
+/**
288 288
      * Check if a value is not equal to another before sending the request
289 289
      *
290 290
      * @param mixed $xValue1    The first value to compare
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
      *
293 293
      * @return self
294 294
      */
295
-    public function ifnte($xValue1, $xValue2): self
296
-    {
297
-        $this->aCondition = ['nte', TypedValue::make($xValue1), TypedValue::make($xValue2)];
298
-        return $this;
299
-    }
295
+public function ifnte($xValue1, $xValue2): self
296
+{
297
+$this->aCondition = ['nte', TypedValue::make($xValue1), TypedValue::make($xValue2)];
298
+return $this;
299
+}
300 300
 
301
-    /**
301
+/**
302 302
      * Check if a value is greater than another before sending the request
303 303
      *
304 304
      * @param mixed $xValue1    The first value to compare
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
      *
307 307
      * @return self
308 308
      */
309
-    public function ifgt($xValue1, $xValue2): self
310
-    {
311
-        $this->aCondition = ['gt', TypedValue::make($xValue1), TypedValue::make($xValue2)];
312
-        return $this;
313
-    }
309
+public function ifgt($xValue1, $xValue2): self
310
+{
311
+$this->aCondition = ['gt', TypedValue::make($xValue1), TypedValue::make($xValue2)];
312
+return $this;
313
+}
314 314
 
315
-    /**
315
+/**
316 316
      * Check if a value is greater or equal to another before sending the request
317 317
      *
318 318
      * @param mixed $xValue1    The first value to compare
@@ -320,13 +320,13 @@  discard block
 block discarded – undo
320 320
      *
321 321
      * @return self
322 322
      */
323
-    public function ifge($xValue1, $xValue2): self
324
-    {
325
-        $this->aCondition = ['ge', TypedValue::make($xValue1), TypedValue::make($xValue2)];
326
-        return $this;
327
-    }
323
+public function ifge($xValue1, $xValue2): self
324
+{
325
+$this->aCondition = ['ge', TypedValue::make($xValue1), TypedValue::make($xValue2)];
326
+return $this;
327
+}
328 328
 
329
-    /**
329
+/**
330 330
      * Check if a value is lower than another before sending the request
331 331
      *
332 332
      * @param mixed $xValue1    The first value to compare
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
      *
335 335
      * @return self
336 336
      */
337
-    public function iflt($xValue1, $xValue2): self
338
-    {
339
-        $this->aCondition = ['lt', TypedValue::make($xValue1), TypedValue::make($xValue2)];
340
-        return $this;
341
-    }
337
+public function iflt($xValue1, $xValue2): self
338
+{
339
+$this->aCondition = ['lt', TypedValue::make($xValue1), TypedValue::make($xValue2)];
340
+return $this;
341
+}
342 342
 
343
-    /**
343
+/**
344 344
      * Check if a value is lower or equal to another before sending the request
345 345
      *
346 346
      * @param mixed $xValue1    The first value to compare
@@ -348,13 +348,13 @@  discard block
 block discarded – undo
348 348
      *
349 349
      * @return self
350 350
      */
351
-    public function ifle($xValue1, $xValue2): self
352
-    {
353
-        $this->aCondition = ['le', TypedValue::make($xValue1), TypedValue::make($xValue2)];
354
-        return $this;
355
-    }
351
+public function ifle($xValue1, $xValue2): self
352
+{
353
+$this->aCondition = ['le', TypedValue::make($xValue1), TypedValue::make($xValue2)];
354
+return $this;
355
+}
356 356
 
357
-    /**
357
+/**
358 358
      * Add a condition to the request
359 359
      *
360 360
      * The request is sent only if the condition is true.
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
      *
364 364
      * @return self
365 365
      */
366
-    public function when($xCondition): self
367
-    {
368
-        return $this->ifeq(true, $xCondition);
369
-    }
366
+public function when($xCondition): self
367
+{
368
+return $this->ifeq(true, $xCondition);
369
+}
370 370
 
371
-    /**
371
+/**
372 372
      * Add a condition to the request
373 373
      *
374 374
      * The request is sent only if the condition is false.
@@ -377,78 +377,78 @@  discard block
 block discarded – undo
377 377
      *
378 378
      * @return self
379 379
      */
380
-    public function unless($xCondition): self
381
-    {
382
-        return $this->ifeq(false, $xCondition);
383
-    }
380
+public function unless($xCondition): self
381
+{
382
+return $this->ifeq(false, $xCondition);
383
+}
384 384
 
385
-    /**
385
+/**
386 386
      * @return self
387 387
      */
388
-    public function toInt(): self
389
-    {
390
-        $this->aCalls[] = [
391
-            '_type' => 'func',
392
-            '_name' => 'toInt',
393
-        ];
394
-        return $this;
395
-    }
388
+public function toInt(): self
389
+{
390
+$this->aCalls[] = [
391
+'_type' => 'func',
392
+'_name' => 'toInt',
393
+];
394
+return $this;
395
+}
396 396
 
397
-    /**
397
+/**
398 398
      * @return self
399 399
      */
400
-    public function trim(): self
401
-    {
402
-        $this->aCalls[] = [
403
-            '_type' => 'func',
404
-            '_name' => 'trim',
405
-        ];
406
-        return $this;
407
-    }
400
+public function trim(): self
401
+{
402
+$this->aCalls[] = [
403
+'_type' => 'func',
404
+'_name' => 'trim',
405
+];
406
+return $this;
407
+}
408 408
 
409
-    /**
409
+/**
410 410
      * @inheritDoc
411 411
      */
412
-    public function getType(): string
413
-    {
414
-        return 'expr';
415
-    }
412
+public function getType(): string
413
+{
414
+return 'expr';
415
+}
416 416
 
417
-    /**
417
+/**
418 418
      * Convert this call to array, when converting the response into json.
419 419
      *
420 420
      * @return array
421 421
      */
422
-    public function jsonSerialize(): array
423
-    {
424
-        $aJsExpr = [
425
-            '_type' => $this->getType(),
426
-            'calls' => array_map(fn(JsonSerializable|array $xCall) =>
427
-                is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls),
428
-        ];
429
-        if(($this->aConfirm))
430
-        {
431
-            $aJsExpr['confirm'] = $this->aConfirm;
432
-        }
433
-        if(($this->aCondition))
434
-        {
435
-            $aJsExpr['condition'] = $this->aCondition;
436
-        }
437
-        if(($this->aAlert))
438
-        {
439
-            $aJsExpr['alert'] = $this->aAlert;
440
-        }
441
-
442
-        return $aJsExpr;
443
-    }
444
-
445
-    /**
422
+public function jsonSerialize(): array
423
+{
424
+$aJsExpr = [
425
+'_type' => $this->getType(),
426
+'calls' => array_map(fn(JsonSerializable|array $xCall) =>
427
+    is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls),
428
+];
429
+if(($this->aConfirm))
430
+{
431
+$aJsExpr['confirm'] = $this->aConfirm;
432
+}
433
+if(($this->aCondition))
434
+{
435
+$aJsExpr['condition'] = $this->aCondition;
436
+}
437
+if(($this->aAlert))
438
+{
439
+$aJsExpr['alert'] = $this->aAlert;
440
+}
441
+
442
+return $aJsExpr;
443
+}
444
+
445
+/**
446 446
      * Returns a call to jaxon as a string
447 447
      *
448 448
      * @return string
449 449
      */
450
-    public function __toString(): string
451
-    {
452
-        return 'jaxon.exec(' . json_encode($this->jsonSerialize()) . ')';
453
-    }
450
+public function __toString(): string
451
+{
452
+return 'jaxon.exec(' . json_encode($this->jsonSerialize()) . ')';
453
+}
454 454
 }
Please login to merge, or discard this patch.
jaxon-dialogs/src/Dialog/AbstractLibrary.php 1 patch
Switch Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -20,94 +20,94 @@
 block discarded – undo
20 20
 
21 21
 abstract class AbstractLibrary
22 22
 {
23
-    /**
23
+/**
24 24
      * The dialog library helper
25 25
      *
26 26
      * @var LibraryHelper|null
27 27
      */
28
-    private $xHelper = null;
28
+private $xHelper = null;
29 29
 
30
-    /**
30
+/**
31 31
      * The css files
32 32
      *
33 33
      * @var array
34 34
      */
35
-    protected $aCssFiles = [];
35
+protected $aCssFiles = [];
36 36
 
37
-    /**
37
+/**
38 38
      * The js files
39 39
      *
40 40
      * @var array
41 41
      */
42
-    protected $aJsFiles = [];
42
+protected $aJsFiles = [];
43 43
 
44
-    /**
44
+/**
45 45
      * Get the library name
46 46
      *
47 47
      * @return string
48 48
      */
49
-    abstract public function getName(): string;
49
+abstract public function getName(): string;
50 50
 
51
-    /**
51
+/**
52 52
      * Get the helper
53 53
      *
54 54
      * @return LibraryHelper
55 55
      */
56
-    public function helper(): LibraryHelper
57
-    {
58
-        return $this->xHelper ?:
59
-            $this->xHelper = dialog()->getLibraryHelper($this->getName());
60
-    }
56
+public function helper(): LibraryHelper
57
+{
58
+return $this->xHelper ?:
59
+$this->xHelper = dialog()->getLibraryHelper($this->getName());
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * Get the library base URI
64 64
      *
65 65
      * @return string
66 66
      */
67
-    public function getUri(): string
68
-    {
69
-        return '';
70
-    }
67
+public function getUri(): string
68
+{
69
+return '';
70
+}
71 71
 
72
-    /**
72
+/**
73 73
      * Get the CSS header code and file includes
74 74
      *
75 75
      * @return string
76 76
      */
77
-    public function getJs(): string
78
-    {
79
-        return $this->helper()->getJs($this->aJsFiles);
80
-    }
77
+public function getJs(): string
78
+{
79
+return $this->helper()->getJs($this->aJsFiles);
80
+}
81 81
 
82
-    /**
82
+/**
83 83
      * Get the javascript header code and file includes
84 84
      *
85 85
      * @return string
86 86
      */
87
-    public function getCss(): string
88
-    {
89
-        return $this->helper()->getCss($this->aCssFiles);
90
-    }
87
+public function getCss(): string
88
+{
89
+return $this->helper()->getCss($this->aCssFiles);
90
+}
91 91
 
92
-    /**
92
+/**
93 93
      * Get the javascript code to be printed into the page
94 94
      *
95 95
      * @return string
96 96
      */
97
-    public function getScript(): string
98
-    {
99
-        return '';
100
-    }
97
+public function getScript(): string
98
+{
99
+return '';
100
+}
101 101
 
102
-    /**
102
+/**
103 103
      * Get the javascript code to be executed on page load
104 104
      *
105 105
      * @return JsCode|null
106 106
      */
107
-    public function getJsCode(): ?JsCode
108
-    {
109
-        $xJsCode = new JsCode();
110
-        $xJsCode->sJs = $this->helper()->getScript();
111
-        return $xJsCode;
112
-    }
107
+public function getJsCode(): ?JsCode
108
+{
109
+$xJsCode = new JsCode();
110
+$xJsCode->sJs = $this->helper()->getScript();
111
+return $xJsCode;
112
+}
113 113
 }
Please login to merge, or discard this patch.
jaxon-upload/src/register.php 1 patch
Switch Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -22,63 +22,63 @@  discard block
 block discarded – undo
22 22
  */
23 23
 function registerUpload(): void
24 24
 {
25
-    $jaxon = jaxon();
26
-    $di = $jaxon->di();
27
-    if($di->h(UploadHandler::class))
28
-    {
29
-        return;
30
-    }
25
+$jaxon = jaxon();
26
+$di = $jaxon->di();
27
+if($di->h(UploadHandler::class))
28
+{
29
+return;
30
+}
31 31
 
32
-    // Upload file and dir name generator
33
-    $di->set(FileNameInterface::class, function() {
34
-        return new class implements FileNameInterface
35
-        {
36
-            public function random(int $nLength): string
37
-            {
38
-                return bin2hex(random_bytes((int)($nLength / 2)));
39
-            }
40
-        };
41
-    });
42
-    // Upload validator
43
-    $di->set(Validator::class, function($c) {
44
-        return new Validator($c->g(ConfigManager::class), $c->g(Translator::class));
45
-    });
46
-    // File storage
47
-    $di->set(FileStorage::class, function($c) {
48
-        return  new FileStorage($c->g(ConfigManager::class), $c->g(Translator::class));
49
-    });
50
-    // File upload manager
51
-    $di->set(UploadManager::class, function($c) {
52
-        // Translation directory
53
-        $sTranslationDir = dirname(__DIR__) . '/translations';
54
-        // Load the upload translations
55
-        $xTranslator = $c->g(Translator::class);
56
-        $xTranslator->loadTranslations("$sTranslationDir/en/upload.php", 'en');
57
-        $xTranslator->loadTranslations("$sTranslationDir/fr/upload.php", 'fr');
58
-        $xTranslator->loadTranslations("$sTranslationDir/es/upload.php", 'es');
32
+// Upload file and dir name generator
33
+$di->set(FileNameInterface::class, function() {
34
+return new class implements FileNameInterface
35
+{
36
+public function random(int $nLength): string
37
+{
38
+    return bin2hex(random_bytes((int)($nLength / 2)));
39
+}
40
+};
41
+});
42
+// Upload validator
43
+$di->set(Validator::class, function($c) {
44
+return new Validator($c->g(ConfigManager::class), $c->g(Translator::class));
45
+});
46
+// File storage
47
+$di->set(FileStorage::class, function($c) {
48
+return  new FileStorage($c->g(ConfigManager::class), $c->g(Translator::class));
49
+});
50
+// File upload manager
51
+$di->set(UploadManager::class, function($c) {
52
+// Translation directory
53
+$sTranslationDir = dirname(__DIR__) . '/translations';
54
+// Load the upload translations
55
+$xTranslator = $c->g(Translator::class);
56
+$xTranslator->loadTranslations("$sTranslationDir/en/upload.php", 'en');
57
+$xTranslator->loadTranslations("$sTranslationDir/fr/upload.php", 'fr');
58
+$xTranslator->loadTranslations("$sTranslationDir/es/upload.php", 'es');
59 59
 
60
-        return new UploadManager($c->g(LoggerInterface::class), $c->g(Validator::class),
61
-            $xTranslator, $c->g(FileStorage::class),
62
-            $c->g(FileNameInterface::class));
63
-    });
64
-    // File upload plugin
65
-    $di->set(UploadHandler::class, function($c) {
66
-        return new UploadHandler($c->g(FileStorage::class), $c->g(UploadManager::class));
67
-    });
68
-    // Set alias on the interface
69
-    $di->alias(UploadHandlerInterface::class, UploadHandler::class);
60
+return new UploadManager($c->g(LoggerInterface::class), $c->g(Validator::class),
61
+$xTranslator, $c->g(FileStorage::class),
62
+$c->g(FileNameInterface::class));
63
+});
64
+// File upload plugin
65
+$di->set(UploadHandler::class, function($c) {
66
+return new UploadHandler($c->g(FileStorage::class), $c->g(UploadManager::class));
67
+});
68
+// Set alias on the interface
69
+$di->alias(UploadHandlerInterface::class, UploadHandler::class);
70 70
 
71
-    // Set a callback to process uploaded files in the incoming requests.
72
-    $jaxon->callback()->before(function() use($di) {
73
-        /** @var UploadHandler */
74
-        $xUploadHandler = $di->g(UploadHandler::class);
75
-        // The HTTP request
76
-        $xRequest = $di->getRequest();
77
-        if($xUploadHandler->canProcessRequest($xRequest))
78
-        {
79
-            $xUploadHandler->processRequest($xRequest);
80
-        }
81
-    });
71
+// Set a callback to process uploaded files in the incoming requests.
72
+$jaxon->callback()->before(function() use($di) {
73
+/** @var UploadHandler */
74
+$xUploadHandler = $di->g(UploadHandler::class);
75
+// The HTTP request
76
+$xRequest = $di->getRequest();
77
+if($xUploadHandler->canProcessRequest($xRequest))
78
+{
79
+$xUploadHandler->processRequest($xRequest);
80
+}
81
+});
82 82
 }
83 83
 
84 84
 /**
@@ -88,22 +88,22 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function _register(): void
90 90
 {
91
-    $jaxon = jaxon();
92
-    $jaxon->callback()->boot(function() use($jaxon) {
93
-        if($jaxon->getOption('core.upload.enabled'))
94
-        {
95
-            registerUpload();
96
-        }
97
-    });
91
+$jaxon = jaxon();
92
+$jaxon->callback()->boot(function() use($jaxon) {
93
+if($jaxon->getOption('core.upload.enabled'))
94
+{
95
+registerUpload();
96
+}
97
+});
98 98
 }
99 99
 
100 100
 function register()
101 101
 {
102
-    // Do nothing if running in cli.
103
-    if(php_sapi_name() !== 'cli')
104
-    {
105
-        _register();
106
-    };
102
+// Do nothing if running in cli.
103
+if(php_sapi_name() !== 'cli')
104
+{
105
+_register();
106
+};
107 107
 }
108 108
 
109 109
 register();
Please login to merge, or discard this patch.