Passed
Push — main ( 957ef0...483b9f )
by Thierry
04:08
created
jaxon-core/src/Plugin/Request/CallableClass/ComponentOptions.php 2 patches
Spacing   +22 added lines, -25 removed lines patch added patch discarded remove patch
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
         $sSeparator = $aOptions['separator'] ?? '.';
107 107
         $this->sSeparator = $sSeparator === '_' ? '_' : '.';
108 108
         $this->addProtectedMethods($aOptions['protected'] ?? []);
109
-        foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
109
+        foreach ($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110 110
         {
111 111
             // Names are in a comma-separated list.
112 112
             $aFunctionNames = explode(',', $sNames);
113
-            foreach($aFunctionNames as $sFunctionName)
113
+            foreach ($aFunctionNames as $sFunctionName)
114 114
             {
115 115
                 $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116 116
             }
117 117
         }
118 118
 
119 119
         // Options from the attributes or annotations.
120
-        if($xMetadata !== null)
120
+        if ($xMetadata !== null)
121 121
         {
122 122
             $this->readMetadataOptions($xMetadata);
123 123
         }
@@ -133,8 +133,7 @@  discard block
 block discarded – undo
133 133
     private function addProtectedMethods(array|string $xMethods): void
134 134
     {
135 135
         $this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
136
-            !is_array($xMethods) ? [trim((string)$xMethods)] :
137
-            array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
136
+            !is_array($xMethods) ? [trim((string)$xMethods)] : array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
138 137
     }
139 138
 
140 139
     /**
@@ -149,7 +148,7 @@  discard block
 block discarded – undo
149 148
         $aExportMethods['except'] = array_unique(array_merge(
150 149
             $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151 150
         $this->aExportMethods = $aExportMethods;
152
-        foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
151
+        foreach ($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153 152
         {
154 153
             $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155 154
         }
@@ -162,7 +161,7 @@  discard block
 block discarded – undo
162 161
      */
163 162
     private function filterPublicMethods(array $aMethods): array
164 163
     {
165
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
164
+        if ($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166 165
         {
167 166
             return [];
168 167
         }
@@ -170,12 +169,12 @@  discard block
 block discarded – undo
170 169
         $aBaseMethods = $aMethods[1];
171 170
         $aNoMethods = $aMethods[2];
172 171
         $aMethods = $aMethods[0];
173
-        if(isset($this->aExportMethods['only']))
172
+        if (isset($this->aExportMethods['only']))
174 173
         {
175 174
             $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176 175
         }
177 176
         $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
177
+        if (count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179 178
         {
180 179
             $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181 180
         }
@@ -261,19 +260,19 @@  discard block
 block discarded – undo
261 260
      */
262 261
     private function setHookMethods(array &$aHookMethods, $xValue): void
263 262
     {
264
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
263
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
265 264
         {
266
-            if(!isset($aHookMethods[$sCalledMethod]))
265
+            if (!isset($aHookMethods[$sCalledMethod]))
267 266
             {
268 267
                 $aHookMethods[$sCalledMethod] = [];
269 268
             }
270
-            if(is_array($xMethodToCall))
269
+            if (is_array($xMethodToCall))
271 270
             {
272 271
                 $aHookMethods[$sCalledMethod] =
273 272
                     array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274 273
                 continue;
275 274
             }
276
-            if(is_string($xMethodToCall))
275
+            if (is_string($xMethodToCall))
277 276
             {
278 277
                 $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279 278
             }
@@ -298,7 +297,7 @@  discard block
 block discarded – undo
298 297
      */
299 298
     private function addOption(string $sName, $xValue): void
300 299
     {
301
-        switch($sName)
300
+        switch ($sName)
302 301
         {
303 302
         // Set the methods to call before processing the request
304 303
         case '__before':
@@ -326,11 +325,11 @@  discard block
 block discarded – undo
326 325
      */
327 326
     private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
328 327
     {
329
-        if(is_string($xOptionValue))
328
+        if (is_string($xOptionValue))
330 329
         {
331 330
             $xOptionValue = [$xOptionValue];
332 331
         }
333
-        if(!is_array($xOptionValue))
332
+        if (!is_array($xOptionValue))
334 333
         {
335 334
             return; // Do not save.
336 335
         }
@@ -360,10 +359,10 @@  discard block
 block discarded – undo
360 359
      */
361 360
     private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
362 361
     {
363
-        switch($sOptionName)
362
+        switch ($sOptionName)
364 363
         {
365 364
         case 'excluded':
366
-            if((bool)$xOptionValue)
365
+            if ((bool)$xOptionValue)
367 366
             {
368 367
                 $this->addProtectedMethods($sFunctionName);
369 368
             }
@@ -387,12 +386,11 @@  discard block
 block discarded – undo
387 386
      */
388 387
     private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions): void
389 388
     {
390
-        foreach($aFunctionOptions as $sOptionName => $xOptionValue)
389
+        foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
391 390
         {
392 391
             substr($sOptionName, 0, 2) === '__' ?
393 392
                 // Options for PHP classes. They start with "__".
394
-                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) :
395
-                // Options for javascript code.
393
+                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code.
396 394
                 $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue);
397 395
         }
398 396
     }
@@ -408,16 +406,15 @@  discard block
 block discarded – undo
408 406
         $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array
409 407
         // Then add the method options.
410 408
         $aMethodOptions = $this->aJsOptions[$sMethodName] ?? [];
411
-        foreach($aMethodOptions as $sOptionName => $xOptionValue)
409
+        foreach ($aMethodOptions as $sOptionName => $xOptionValue)
412 410
         {
413 411
             // For databags and callbacks, merge the values in a single array.
414 412
             // For all the other options, keep the last value.
415 413
             $aOptions[$sOptionName] = !in_array($sOptionName, ['bags', 'callback']) ?
416
-                $xOptionValue :
417
-                array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
414
+                $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
418 415
         }
419 416
         // Since callbacks are js object names, they need a special formatting.
420
-        if(isset($aOptions['callback']))
417
+        if (isset($aOptions['callback']))
421 418
         {
422 419
             $aOptions['callback'] = str_replace('"', '', json_encode($aOptions['callback']));
423 420
         }
Please login to merge, or discard this patch.
Switch Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -34,224 +34,224 @@  discard block
 block discarded – undo
34 34
 
35 35
 class ComponentOptions
36 36
 {
37
-    /**
37
+/**
38 38
      * Check if the js code for this object must be generated
39 39
      *
40 40
      * @var bool
41 41
      */
42
-    private $bExcluded = false;
42
+private $bExcluded = false;
43 43
 
44
-    /**
44
+/**
45 45
      * The character to use as separator in javascript class names
46 46
      *
47 47
      * @var string
48 48
      */
49
-    private $sSeparator = '.';
49
+private $sSeparator = '.';
50 50
 
51
-    /**
51
+/**
52 52
      * A list of methods of the user registered callable object the library can export to javascript
53 53
      *
54 54
      * @var array
55 55
      */
56
-    private $aPublicMethods = [];
56
+private $aPublicMethods = [];
57 57
 
58
-    /**
58
+/**
59 59
      * The methods in the export attributes
60 60
      *
61 61
      * @var array
62 62
      */
63
-    private $aExportMethods = ['except' => []];
63
+private $aExportMethods = ['except' => []];
64 64
 
65
-    /**
65
+/**
66 66
      * A list of methods to call before processing the request
67 67
      *
68 68
      * @var array
69 69
      */
70
-    private $aBeforeMethods = [];
70
+private $aBeforeMethods = [];
71 71
 
72
-    /**
72
+/**
73 73
      * A list of methods to call after processing the request
74 74
      *
75 75
      * @var array
76 76
      */
77
-    private $aAfterMethods = [];
77
+private $aAfterMethods = [];
78 78
 
79
-    /**
79
+/**
80 80
      * The javascript class options
81 81
      *
82 82
      * @var array
83 83
      */
84
-    private $aJsOptions = [];
84
+private $aJsOptions = [];
85 85
 
86
-    /**
86
+/**
87 87
      * The DI options
88 88
      *
89 89
      * @var array
90 90
      */
91
-    private $aDiOptions = [];
91
+private $aDiOptions = [];
92 92
 
93
-    /**
93
+/**
94 94
      * The constructor
95 95
      *
96 96
      * @param array $aMethods
97 97
      * @param array $aOptions
98 98
      * @param Metadata|null $xMetadata
99 99
      */
100
-    public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
-    {
102
-        $this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
-            (bool)($aOptions['excluded'] ?? false);
104
-
105
-        // Options from the config.
106
-        $sSeparator = $aOptions['separator'] ?? '.';
107
-        $this->sSeparator = $sSeparator === '_' ? '_' : '.';
108
-        $this->addProtectedMethods($aOptions['protected'] ?? []);
109
-        foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110
-        {
111
-            // Names are in a comma-separated list.
112
-            $aFunctionNames = explode(',', $sNames);
113
-            foreach($aFunctionNames as $sFunctionName)
114
-            {
115
-                $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116
-            }
117
-        }
100
+public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
+{
102
+$this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
+(bool)($aOptions['excluded'] ?? false);
104
+
105
+// Options from the config.
106
+$sSeparator = $aOptions['separator'] ?? '.';
107
+$this->sSeparator = $sSeparator === '_' ? '_' : '.';
108
+$this->addProtectedMethods($aOptions['protected'] ?? []);
109
+foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110
+{
111
+// Names are in a comma-separated list.
112
+$aFunctionNames = explode(',', $sNames);
113
+foreach($aFunctionNames as $sFunctionName)
114
+{
115
+    $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116
+}
117
+}
118 118
 
119
-        // Options from the attributes or annotations.
120
-        if($xMetadata !== null)
121
-        {
122
-            $this->readMetadataOptions($xMetadata);
123
-        }
119
+// Options from the attributes or annotations.
120
+if($xMetadata !== null)
121
+{
122
+$this->readMetadataOptions($xMetadata);
123
+}
124 124
 
125
-        $this->aPublicMethods = $this->filterPublicMethods($aMethods);
126
-    }
125
+$this->aPublicMethods = $this->filterPublicMethods($aMethods);
126
+}
127 127
 
128
-    /**
128
+/**
129 129
      * @param array|string $xMethods
130 130
      *
131 131
      * @return void
132 132
      */
133
-    private function addProtectedMethods(array|string $xMethods): void
134
-    {
135
-        $this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
136
-            !is_array($xMethods) ? [trim((string)$xMethods)] :
137
-            array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
138
-    }
133
+private function addProtectedMethods(array|string $xMethods): void
134
+{
135
+$this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
136
+!is_array($xMethods) ? [trim((string)$xMethods)] :
137
+array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * @param Metadata $xMetadata
142 142
      *
143 143
      * @return void
144 144
      */
145
-    private function readMetadataOptions(Metadata $xMetadata): void
146
-    {
147
-        // Excluded methods must be merged with the existing ones.
148
-        $aExportMethods = $xMetadata->getExportMethods();
149
-        $aExportMethods['except'] = array_unique(array_merge(
150
-            $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151
-        $this->aExportMethods = $aExportMethods;
152
-        foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153
-        {
154
-            $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155
-        }
156
-    }
145
+private function readMetadataOptions(Metadata $xMetadata): void
146
+{
147
+// Excluded methods must be merged with the existing ones.
148
+$aExportMethods = $xMetadata->getExportMethods();
149
+$aExportMethods['except'] = array_unique(array_merge(
150
+$aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151
+$this->aExportMethods = $aExportMethods;
152
+foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153
+{
154
+$this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155
+}
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * @param array $aMethods
160 160
      *
161 161
      * @return array
162 162
      */
163
-    private function filterPublicMethods(array $aMethods): array
164
-    {
165
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166
-        {
167
-            return [];
168
-        }
163
+private function filterPublicMethods(array $aMethods): array
164
+{
165
+if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166
+{
167
+return [];
168
+}
169 169
 
170
-        $aBaseMethods = $aMethods[1];
171
-        $aNoMethods = $aMethods[2];
172
-        $aMethods = $aMethods[0];
173
-        if(isset($this->aExportMethods['only']))
174
-        {
175
-            $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176
-        }
177
-        $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179
-        {
180
-            $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181
-        }
170
+$aBaseMethods = $aMethods[1];
171
+$aNoMethods = $aMethods[2];
172
+$aMethods = $aMethods[0];
173
+if(isset($this->aExportMethods['only']))
174
+{
175
+$aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176
+}
177
+$aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
+if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179
+{
180
+$aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181
+}
182 182
 
183
-        return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
184
-    }
183
+return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
184
+}
185 185
 
186
-    /**
186
+/**
187 187
      * @return array
188 188
      */
189
-    public function getPublicMethods(): array
190
-    {
191
-        return $this->aPublicMethods;
192
-    }
189
+public function getPublicMethods(): array
190
+{
191
+return $this->aPublicMethods;
192
+}
193 193
 
194
-    /**
194
+/**
195 195
      * @param string $sMethodName
196 196
      *
197 197
      * @return bool
198 198
      */
199
-    public function isPublicMethod(string $sMethodName): bool
200
-    {
201
-        return in_array($sMethodName, $this->aPublicMethods);
202
-    }
199
+public function isPublicMethod(string $sMethodName): bool
200
+{
201
+return in_array($sMethodName, $this->aPublicMethods);
202
+}
203 203
 
204
-    /**
204
+/**
205 205
      * Check if the js code for this object must be generated
206 206
      *
207 207
      * @return bool
208 208
      */
209
-    public function excluded(): bool
210
-    {
211
-        return $this->bExcluded;
212
-    }
209
+public function excluded(): bool
210
+{
211
+return $this->bExcluded;
212
+}
213 213
 
214
-    /**
214
+/**
215 215
      * @return string
216 216
      */
217
-    public function separator(): string
218
-    {
219
-        return $this->sSeparator;
220
-    }
217
+public function separator(): string
218
+{
219
+return $this->sSeparator;
220
+}
221 221
 
222
-    /**
222
+/**
223 223
      * @return array
224 224
      */
225
-    public function beforeMethods(): array
226
-    {
227
-        return $this->aBeforeMethods;
228
-    }
225
+public function beforeMethods(): array
226
+{
227
+return $this->aBeforeMethods;
228
+}
229 229
 
230
-    /**
230
+/**
231 231
      * @return array
232 232
      */
233
-    public function afterMethods(): array
234
-    {
235
-        return $this->aAfterMethods;
236
-    }
233
+public function afterMethods(): array
234
+{
235
+return $this->aAfterMethods;
236
+}
237 237
 
238
-    /**
238
+/**
239 239
      * @return array
240 240
      */
241
-    public function diOptions(): array
242
-    {
243
-        return $this->aDiOptions;
244
-    }
241
+public function diOptions(): array
242
+{
243
+return $this->aDiOptions;
244
+}
245 245
 
246
-    /**
246
+/**
247 247
      * @return array
248 248
      */
249
-    public function jsOptions(): array
250
-    {
251
-        return $this->aJsOptions;
252
-    }
249
+public function jsOptions(): array
250
+{
251
+return $this->aJsOptions;
252
+}
253 253
 
254
-    /**
254
+/**
255 255
      * Set hook methods
256 256
      *
257 257
      * @param array $aHookMethods    The array of hook methods
@@ -259,36 +259,36 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return void
261 261
      */
262
-    private function setHookMethods(array &$aHookMethods, $xValue): void
263
-    {
264
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
265
-        {
266
-            if(!isset($aHookMethods[$sCalledMethod]))
267
-            {
268
-                $aHookMethods[$sCalledMethod] = [];
269
-            }
270
-            if(is_array($xMethodToCall))
271
-            {
272
-                $aHookMethods[$sCalledMethod] =
273
-                    array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274
-                continue;
275
-            }
276
-            if(is_string($xMethodToCall))
277
-            {
278
-                $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279
-            }
280
-        }
281
-    }
262
+private function setHookMethods(array &$aHookMethods, $xValue): void
263
+{
264
+foreach($xValue as $sCalledMethod => $xMethodToCall)
265
+{
266
+if(!isset($aHookMethods[$sCalledMethod]))
267
+{
268
+    $aHookMethods[$sCalledMethod] = [];
269
+}
270
+if(is_array($xMethodToCall))
271
+{
272
+    $aHookMethods[$sCalledMethod] =
273
+        array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274
+    continue;
275
+}
276
+if(is_string($xMethodToCall))
277
+{
278
+    $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279
+}
280
+}
281
+}
282 282
 
283
-    /**
283
+/**
284 284
      * @param array $aDiOptions
285 285
      */
286
-    private function addDiOption(array $aDiOptions): void
287
-    {
288
-        $this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
289
-    }
286
+private function addDiOption(array $aDiOptions): void
287
+{
288
+$this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
289
+}
290 290
 
291
-    /**
291
+/**
292 292
      * Set configuration options / call options for each method
293 293
      *
294 294
      * @param string $sName    The name of the configuration option
@@ -296,25 +296,25 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return void
298 298
      */
299
-    private function addOption(string $sName, $xValue): void
300
-    {
301
-        switch($sName)
302
-        {
303
-        // Set the methods to call before processing the request
304
-        case '__before':
305
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
306
-            break;
307
-        // Set the methods to call after processing the request
308
-        case '__after':
309
-            $this->setHookMethods($this->aAfterMethods, $xValue);
310
-            break;
311
-        // Set the attributes to inject in the callable object
312
-        case '__di':
313
-            $this->addDiOption($xValue);
314
-            break;
315
-        default:
316
-            break;
317
-        }
299
+private function addOption(string $sName, $xValue): void
300
+{
301
+switch($sName)
302
+{
303
+// Set the methods to call before processing the request
304
+case '__before':
305
+$this->setHookMethods($this->aBeforeMethods, $xValue);
306
+break;
307
+// Set the methods to call after processing the request
308
+case '__after':
309
+$this->setHookMethods($this->aAfterMethods, $xValue);
310
+break;
311
+// Set the attributes to inject in the callable object
312
+case '__di':
313
+$this->addDiOption($xValue);
314
+break;
315
+default:
316
+break;
317
+}
318 318
     }
319 319
 
320 320
     /**
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Inject.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
 
22 22
 use function ltrim;
23 23
 
24
-#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_PROPERTY |
25
-    Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
24
+#[Attribute(Attribute::TARGET_CLASS|Attribute::TARGET_PROPERTY|
25
+    Attribute::TARGET_METHOD|Attribute::IS_REPEATABLE)]
26 26
 class Inject extends AbstractAttribute
27 27
 {
28 28
     /**
@@ -78,17 +78,17 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function validate(): void
80 80
     {
81
-        if($this->nTarget === Attribute::TARGET_CLASS)
81
+        if ($this->nTarget === Attribute::TARGET_CLASS)
82 82
         {
83
-            if(!$this->attr || !$this->type)
83
+            if (!$this->attr || !$this->type)
84 84
             {
85 85
                 throw new SetupException('When applied to a class, the Inject attribute requires two arguments.');
86 86
             }
87 87
             return;
88 88
         }
89
-        if($this->nTarget === Attribute::TARGET_METHOD)
89
+        if ($this->nTarget === Attribute::TARGET_METHOD)
90 90
         {
91
-            if(!$this->attr)
91
+            if (!$this->attr)
92 92
             {
93 93
                 throw new SetupException('When applied to a method, the Inject attribute requires the "attr" argument.');
94 94
             }
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
      */
101 101
     private function getFullClassName(): void
102 102
     {
103
-        if(!$this->type)
103
+        if (!$this->type)
104 104
         {
105 105
             // If no type is provided, take the attribute type.
106 106
             $this->type = $this->aTypes[$this->attr] ?? '';
107 107
             return;
108 108
         }
109
-        if($this->type[0] === '\\')
109
+        if ($this->type[0] === '\\')
110 110
         {
111 111
             $this->type = ltrim($this->type, '\\');
112 112
         }
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/ComponentTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/ComponentTrait.php 2 patches
Switch Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -241,83 +241,83 @@
 block discarded – undo
241 241
                 $this->aComponentPublicMethods['node'],
242 242
             $xReflectionClass->isSubclassOf(FuncComponent::class) =>
243 243
                 $this->aComponentPublicMethods['func'],
244
-            default => [[], []],
245
-        };
244
+default => [[], []],
245
+};
246 246
 
247
-        return [$aMethods, ...$aBaseMethods];
248
-    }
247
+return [$aMethods, ...$aBaseMethods];
248
+}
249 249
 
250
-    /**
250
+/**
251 251
      * @param ReflectionClass $xReflectionClass
252 252
      * @param array $aMethods
253 253
      * @param array $aOptions
254 254
      *
255 255
      * @return Metadata|null
256 256
      */
257
-    private function getComponentMetadata(ReflectionClass $xReflectionClass,
258
-        array $aMethods, array $aOptions): Metadata|null
259
-    {
260
-        /** @var Config|null */
261
-        $xPackageConfig = $aOptions['config'] ?? null;
262
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263
-        {
264
-            return null;
265
-        }
266
-        $sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
-        if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
268
-        {
269
-            return null;
270
-        }
257
+private function getComponentMetadata(ReflectionClass $xReflectionClass,
258
+array $aMethods, array $aOptions): Metadata|null
259
+{
260
+/** @var Config|null */
261
+$xPackageConfig = $aOptions['config'] ?? null;
262
+if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263
+{
264
+return null;
265
+}
266
+$sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
+if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
268
+{
269
+return null;
270
+}
271 271
 
272
-        // Try to get the class metadata from the cache.
273
-        $di = $this->cn();
274
-        $xMetadata = null;
275
-        $xMetadataCache = null;
276
-        $xConfig = $di->config();
277
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
278
-        {
279
-            if(!$di->h('jaxon_metadata_cache_dir'))
280
-            {
281
-                $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282
-                $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283
-            }
284
-            $xMetadataCache = $di->getMetadataCache();
285
-            $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
-            if($xMetadata !== null)
287
-            {
288
-                return $xMetadata;
289
-            }
290
-        }
272
+// Try to get the class metadata from the cache.
273
+$di = $this->cn();
274
+$xMetadata = null;
275
+$xMetadataCache = null;
276
+$xConfig = $di->config();
277
+if($xConfig->getAppOption('metadata.cache.enabled', false))
278
+{
279
+if(!$di->h('jaxon_metadata_cache_dir'))
280
+{
281
+    $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282
+    $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283
+}
284
+$xMetadataCache = $di->getMetadataCache();
285
+$xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
+if($xMetadata !== null)
287
+{
288
+    return $xMetadata;
289
+}
290
+}
291 291
 
292
-        $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
294
-                ReflectionProperty::IS_PROTECTED));
292
+$aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
+$xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
294
+    ReflectionProperty::IS_PROTECTED));
295 295
 
296
-        $xMetadataReader = $di->getMetadataReader($sMetadataFormat);
297
-        $xInput = new InputData($xReflectionClass, $aMethods, $aProperties);
298
-        $xMetadata = $xMetadataReader->getAttributes($xInput);
296
+$xMetadataReader = $di->getMetadataReader($sMetadataFormat);
297
+$xInput = new InputData($xReflectionClass, $aMethods, $aProperties);
298
+$xMetadata = $xMetadataReader->getAttributes($xInput);
299 299
 
300
-        // Try to save the metadata in the cache
301
-        if($xMetadataCache !== null)
302
-        {
303
-            $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304
-        }
300
+// Try to save the metadata in the cache
301
+if($xMetadataCache !== null)
302
+{
303
+$xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304
+}
305 305
 
306
-        return $xMetadata;
307
-    }
306
+return $xMetadata;
307
+}
308 308
 
309
-    /**
309
+/**
310 310
      * @param ReflectionClass $xReflectionClass
311 311
      * @param array $aOptions
312 312
      *
313 313
      * @return ComponentOptions
314 314
      */
315
-    public function getComponentOptions(ReflectionClass $xReflectionClass,
316
-        array $aOptions): ComponentOptions
317
-    {
318
-        $aMethods = $this->getPublicMethods($xReflectionClass);
319
-        $xMetadata = $this->getComponentMetadata($xReflectionClass, $aMethods[0], $aOptions);
315
+public function getComponentOptions(ReflectionClass $xReflectionClass,
316
+array $aOptions): ComponentOptions
317
+{
318
+$aMethods = $this->getPublicMethods($xReflectionClass);
319
+$xMetadata = $this->getComponentMetadata($xReflectionClass, $aMethods[0], $aOptions);
320 320
 
321
-        return new ComponentOptions($aMethods, $aOptions, $xMetadata);
322
-    }
321
+return new ComponentOptions($aMethods, $aOptions, $xMetadata);
322
+}
323 323
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
         $xRegistry->updateHash(false); // Disable hash calculation.
152 152
 
153 153
         $sComponentId = str_replace('\\', '.', $sClassName);
154
-        if(!isset($this->aComponents[$sComponentId]))
154
+        if (!isset($this->aComponents[$sComponentId]))
155 155
         {
156 156
             $aOptions = $xRegistry->getNamespaceComponentOptions($sClassName);
157
-            if($aOptions !== null)
157
+            if ($aOptions !== null)
158 158
             {
159 159
                 $this->saveComponent($sClassName, $aOptions);
160 160
             }
161 161
         }
162
-        if(isset($this->aComponents[$sComponentId]))
162
+        if (isset($this->aComponents[$sComponentId]))
163 163
         {
164 164
             return; // The component is found.
165 165
         }
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
         // The component was not found in a registered namespace. We need to parse all
168 168
         // the directories to be able to find a component registered without a namespace.
169 169
         $sComponentId = str_replace('\\', '_', $sClassName);
170
-        if(!isset($this->aComponents[$sComponentId]))
170
+        if (!isset($this->aComponents[$sComponentId]))
171 171
         {
172 172
             $xRegistry->registerComponentsInDirectories();
173 173
         }
174
-        if(isset($this->aComponents[$sComponentId]))
174
+        if (isset($this->aComponents[$sComponentId]))
175 175
         {
176 176
             return; // The component is found.
177 177
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function getCallableObjects(): array
190 190
     {
191 191
         $aCallableObjects = [];
192
-        foreach($this->aComponents as $sComponentId => $_)
192
+        foreach ($this->aComponents as $sComponentId => $_)
193 193
         {
194 194
             $aCallableObjects[$sComponentId] = $this->makeCallableObject($sComponentId);
195 195
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function setComponentPublicMethods(string $sKey, string $sClass,
207 207
         array $aNeverExported): void
208 208
     {
209
-        if(isset($this->aComponentPublicMethods[$sKey]))
209
+        if (isset($this->aComponentPublicMethods[$sKey]))
210 210
         {
211 211
             return;
212 212
         }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     {
260 260
         /** @var Config|null */
261 261
         $xPackageConfig = $aOptions['config'] ?? null;
262
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
262
+        if ($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263 263
         {
264 264
             return null;
265 265
         }
266 266
         $sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
-        if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
267
+        if (!in_array($sMetadataFormat, ['attributes', 'annotations']))
268 268
         {
269 269
             return null;
270 270
         }
@@ -274,23 +274,23 @@  discard block
 block discarded – undo
274 274
         $xMetadata = null;
275 275
         $xMetadataCache = null;
276 276
         $xConfig = $di->config();
277
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
277
+        if ($xConfig->getAppOption('metadata.cache.enabled', false))
278 278
         {
279
-            if(!$di->h('jaxon_metadata_cache_dir'))
279
+            if (!$di->h('jaxon_metadata_cache_dir'))
280 280
             {
281 281
                 $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282 282
                 $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283 283
             }
284 284
             $xMetadataCache = $di->getMetadataCache();
285 285
             $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
-            if($xMetadata !== null)
286
+            if ($xMetadata !== null)
287 287
             {
288 288
                 return $xMetadata;
289 289
             }
290 290
         }
291 291
 
292 292
         $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
293
+            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC|
294 294
                 ReflectionProperty::IS_PROTECTED));
295 295
 
296 296
         $xMetadataReader = $di->getMetadataReader($sMetadataFormat);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         $xMetadata = $xMetadataReader->getAttributes($xInput);
299 299
 
300 300
         // Try to save the metadata in the cache
301
-        if($xMetadataCache !== null)
301
+        if ($xMetadataCache !== null)
302 302
         {
303 303
             $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304 304
         }
Please login to merge, or discard this patch.
jaxon-core/src/App/Pagination/Page.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
 
14 14
 class Page
15 15
 {
16
-    /**
16
+/**
17 17
      * @var string
18 18
      */
19
-    public $sType;
19
+public $sType;
20 20
 
21
-    /**
21
+/**
22 22
      * @var string
23 23
      */
24
-    public $sText;
24
+public $sText;
25 25
 
26
-    /**
26
+/**
27 27
      * @var int
28 28
      */
29
-    public $nNumber;
29
+public $nNumber;
30 30
 
31
-    public function __construct(string $sType, string $sText, int $nNumber)
32
-    {
33
-        $this->sType = $sType;
34
-        $this->sText = $sText;
35
-        $this->nNumber = $nNumber;
36
-    }
31
+public function __construct(string $sType, string $sText, int $nNumber)
32
+{
33
+$this->sType = $sType;
34
+$this->sText = $sText;
35
+$this->nNumber = $nNumber;
36
+}
37 37
 }
38 38
\ No newline at end of file
Please login to merge, or discard this patch.
jaxon-core/src/App/View/Store.php 1 patch
Switch Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,35 +9,35 @@  discard block
 block discarded – undo
9 9
 
10 10
 class Store implements JsonSerializable, Stringable
11 11
 {
12
-    /**
12
+/**
13 13
      * The view renderer
14 14
      *
15 15
      * @var ViewInterface|null
16 16
      */
17
-    protected $xRenderer = null;
17
+protected $xRenderer = null;
18 18
 
19
-    /**
19
+/**
20 20
      * The view namespace
21 21
      *
22 22
      * @var string
23 23
      */
24
-    protected $sNamespace;
24
+protected $sNamespace;
25 25
 
26
-    /**
26
+/**
27 27
      * The view name
28 28
      *
29 29
      * @var string
30 30
      */
31
-    protected $sViewName;
31
+protected $sViewName;
32 32
 
33
-    /**
33
+/**
34 34
      * The view data
35 35
      *
36 36
      * @var array
37 37
      */
38
-    protected $aViewData = [];
38
+protected $aViewData = [];
39 39
 
40
-    /**
40
+/**
41 41
      * Make a piece of data available for the rendered view
42 42
      *
43 43
      * @param string $sName    The data name
@@ -45,26 +45,26 @@  discard block
 block discarded – undo
45 45
      *
46 46
      * @return Store
47 47
      */
48
-    public function with(string $sName, $xValue): Store
49
-    {
50
-        $this->aViewData[$sName] = $xValue;
51
-        return $this;
52
-    }
48
+public function with(string $sName, $xValue): Store
49
+{
50
+$this->aViewData[$sName] = $xValue;
51
+return $this;
52
+}
53 53
 
54
-    /**
54
+/**
55 55
      * Set the data to be rendered
56 56
      *
57 57
      * @param array $aViewData    The view data
58 58
      *
59 59
      * @return Store
60 60
      */
61
-    public function setData(array $aViewData): Store
62
-    {
63
-        $this->aViewData = array_merge($this->aViewData, $aViewData);
64
-        return $this;
65
-    }
61
+public function setData(array $aViewData): Store
62
+{
63
+$this->aViewData = array_merge($this->aViewData, $aViewData);
64
+return $this;
65
+}
66 66
 
67
-    /**
67
+/**
68 68
      * Set the view to be rendered, with optional data
69 69
      *
70 70
      * @param ViewInterface $xRenderer    The view renderer
@@ -74,65 +74,65 @@  discard block
 block discarded – undo
74 74
      *
75 75
      * @return Store
76 76
      */
77
-    public function setView(ViewInterface $xRenderer,
78
-        string $sNamespace, string $sViewName, array $aViewData = []): Store
79
-    {
80
-        $this->xRenderer = $xRenderer;
81
-        $this->sNamespace = trim($sNamespace);
82
-        $this->sViewName = trim($sViewName);
83
-        $this->aViewData = array_merge($this->aViewData, $aViewData);
84
-        return $this;
85
-    }
77
+public function setView(ViewInterface $xRenderer,
78
+string $sNamespace, string $sViewName, array $aViewData = []): Store
79
+{
80
+$this->xRenderer = $xRenderer;
81
+$this->sNamespace = trim($sNamespace);
82
+$this->sViewName = trim($sViewName);
83
+$this->aViewData = array_merge($this->aViewData, $aViewData);
84
+return $this;
85
+}
86 86
 
87
-    /**
87
+/**
88 88
      * Get the view namespace
89 89
      *
90 90
      * @return string        The view namespace
91 91
      */
92
-    public function getNamespace(): string
93
-    {
94
-        return $this->sNamespace;
95
-    }
92
+public function getNamespace(): string
93
+{
94
+return $this->sNamespace;
95
+}
96 96
 
97
-    /**
97
+/**
98 98
      * Get the view name
99 99
      *
100 100
      * @return string        The view name
101 101
      */
102
-    public function getViewName(): string
103
-    {
104
-        return $this->sViewName;
105
-    }
102
+public function getViewName(): string
103
+{
104
+return $this->sViewName;
105
+}
106 106
 
107
-    /**
107
+/**
108 108
      * Get the view data
109 109
      *
110 110
      * @return array         The view data
111 111
      */
112
-    public function getViewData(): array
113
-    {
114
-        return $this->aViewData;
115
-    }
112
+public function getViewData(): array
113
+{
114
+return $this->aViewData;
115
+}
116 116
 
117
-    /**
117
+/**
118 118
      * Render a view using third party view system
119 119
      *
120 120
      * @return string        The string representation of the view
121 121
      */
122
-    public function __toString(): string
123
-    {
124
-        return !$this->xRenderer ? '' : $this->xRenderer->render($this);
125
-    }
122
+public function __toString(): string
123
+{
124
+return !$this->xRenderer ? '' : $this->xRenderer->render($this);
125
+}
126 126
 
127
-    /**
127
+/**
128 128
      * Convert this object to string for json.
129 129
      *
130 130
      * This is a method of the JsonSerializable interface.
131 131
      *
132 132
      * @return string
133 133
      */
134
-    public function jsonSerialize(): string
135
-    {
136
-        return $this->__toString();
137
-    }
134
+public function jsonSerialize(): string
135
+{
136
+return $this->__toString();
137
+}
138 138
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/AbstractData.php 1 patch
Switch Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -18,32 +18,32 @@
 block discarded – undo
18 18
 
19 19
 abstract class AbstractData
20 20
 {
21
-    /**
21
+/**
22 22
      * Generate the PHP code to populate a Metadata object
23 23
      *
24 24
      * @param string $sVarName
25 25
      *
26 26
      * @return array
27 27
      */
28
-    abstract public function encode(string $sVarName): array;
28
+abstract public function encode(string $sVarName): array;
29 29
 
30
-    /**
30
+/**
31 31
      * @return string
32 32
      */
33
-    abstract public function getName(): string;
33
+abstract public function getName(): string;
34 34
 
35
-    /**
35
+/**
36 36
      * @return mixed
37 37
      */
38
-    abstract public function getValue(): mixed;
38
+abstract public function getValue(): mixed;
39 39
 
40
-    /**
40
+/**
41 41
      * @param string $sMethod
42 42
      *
43 43
      * @return bool
44 44
      */
45
-    protected function validateMethod(string $sMethod): bool
46
-    {
47
-        return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0;
48
-    }
45
+protected function validateMethod(string $sMethod): bool
46
+{
47
+return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0;
48
+}
49 49
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/AbstractPackage.php 1 patch
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,46 +19,46 @@  discard block
 block discarded – undo
19 19
 
20 20
 abstract class AbstractPackage extends AbstractCodeGenerator
21 21
 {
22
-    /**
22
+/**
23 23
      * The configuration options of the package
24 24
      *
25 25
      * @var Config
26 26
      */
27
-    protected $xPkgConfig;
27
+protected $xPkgConfig;
28 28
 
29
-    /**
29
+/**
30 30
      * The view renderer
31 31
      *
32 32
      * @var ViewRenderer
33 33
      */
34
-    protected $xRenderer;
34
+protected $xRenderer;
35 35
 
36
-    /**
36
+/**
37 37
      * Get the path to the config file, or the config options in an array.
38 38
      *
39 39
      * @return string|array
40 40
      */
41
-    abstract public static function config(): string|array;
41
+abstract public static function config(): string|array;
42 42
 
43
-    /**
43
+/**
44 44
      * Get the package config object
45 45
      *
46 46
      * @return Config
47 47
      */
48
-    final public function getConfig(): Config
49
-    {
50
-        return $this->xPkgConfig;
51
-    }
48
+final public function getConfig(): Config
49
+{
50
+return $this->xPkgConfig;
51
+}
52 52
 
53
-    /**
53
+/**
54 54
      * This method is automatically called after the package instance is created and configured.
55 55
      *
56 56
      * @return void
57 57
      */
58
-    protected function init(): void
59
-    {}
58
+protected function init(): void
59
+{}
60 60
 
61
-    /**
61
+/**
62 62
      * Get the value of a given package option
63 63
      *
64 64
      * @param string $sOption    The option name
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return mixed
68 68
      */
69
-    final public function getOption(string $sOption, $xDefault = null): mixed
70
-    {
71
-        return $this->xPkgConfig->getOption($sOption, $xDefault);
72
-    }
69
+final public function getOption(string $sOption, $xDefault = null): mixed
70
+{
71
+return $this->xPkgConfig->getOption($sOption, $xDefault);
72
+}
73 73
 
74
-    /**
74
+/**
75 75
      * Get the view renderer
76 76
      *
77 77
      * @return ViewRenderer
78 78
      */
79
-    final public function view(): ViewRenderer
80
-    {
81
-        return $this->xRenderer;
82
-    }
79
+final public function view(): ViewRenderer
80
+{
81
+return $this->xRenderer;
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * @inheritDoc
86 86
      */
87
-    final public function getHash(): string
88
-    {
89
-        // Packages do not generate hash on their own. So we make this method final.
90
-        return '';
91
-    }
87
+final public function getHash(): string
88
+{
89
+// Packages do not generate hash on their own. So we make this method final.
90
+return '';
91
+}
92 92
 
93
-    /**
93
+/**
94 94
      * Get the HTML code of the package home page
95 95
      *
96 96
      * @return string|Stringable
97 97
      */
98
-    public function getHtml(): string|Stringable
99
-    {
100
-        return '';
101
-    }
98
+public function getHtml(): string|Stringable
99
+{
100
+return '';
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * Get the HTML code of the package home page
105 105
      *
106 106
      * This method is an alias for getHtml().
107 107
      *
108 108
      * @return string|Stringable
109 109
      */
110
-    public function html(): string|Stringable
111
-    {
112
-        return $this->getHtml();
113
-    }
110
+public function html(): string|Stringable
111
+{
112
+return $this->getHtml();
113
+}
114 114
 
115
-    /**
115
+/**
116 116
      * Get the Js code of the ready() callback
117 117
      *
118 118
      * @return string|Stringable
119 119
      */
120
-    public function getReadyScript(): string|Stringable
121
-    {
122
-        return '';
123
-    }
120
+public function getReadyScript(): string|Stringable
121
+{
122
+return '';
123
+}
124 124
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/RequestTrait.php 1 patch
Switch Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -20,99 +20,99 @@
 block discarded – undo
20 20
 
21 21
 trait RequestTrait
22 22
 {
23
-    /**
23
+/**
24 24
      * Register the values into the container
25 25
      *
26 26
      * @return void
27 27
      */
28
-    private function registerRequests(): void
29
-    {
30
-        // The parameter reader
31
-        $this->set(ParameterReader::class, function($di) {
32
-            return new ParameterReader($di->g(Container::class), $di->g(Translator::class),
33
-                $di->g(ConfigManager::class), $di->g(UriDetector::class));
34
-        });
35
-        // Callback Manager
36
-        $this->set(CallbackManager::class, function($di) {
37
-            return new CallbackManager($di->g(ResponseManager::class));
38
-        });
39
-        // By default, register a null upload handler
40
-        $this->set(UploadHandlerInterface::class, function() {
41
-            return null;
42
-        });
43
-        // Request Handler
44
-        $this->set(RequestHandler::class, function($di) {
45
-            return new RequestHandler($di->g(Container::class), $di->g(PluginManager::class),
46
-                $di->g(ResponseManager::class), $di->g(CallbackManager::class),
47
-                $di->g(DatabagPlugin::class));
48
-        });
49
-        // Requests and calls Factory
50
-        $this->set(CallFactory::class, function($di) {
51
-            return new CallFactory($di->g(ComponentContainer::class), $di->g(DialogCommand::class));
52
-        });
53
-        // Factory for function parameters
54
-        $this->set(ParameterFactory::class, function() {
55
-            return new ParameterFactory();
56
-        });
57
-    }
28
+private function registerRequests(): void
29
+{
30
+// The parameter reader
31
+$this->set(ParameterReader::class, function($di) {
32
+return new ParameterReader($di->g(Container::class), $di->g(Translator::class),
33
+    $di->g(ConfigManager::class), $di->g(UriDetector::class));
34
+});
35
+// Callback Manager
36
+$this->set(CallbackManager::class, function($di) {
37
+return new CallbackManager($di->g(ResponseManager::class));
38
+});
39
+// By default, register a null upload handler
40
+$this->set(UploadHandlerInterface::class, function() {
41
+return null;
42
+});
43
+// Request Handler
44
+$this->set(RequestHandler::class, function($di) {
45
+return new RequestHandler($di->g(Container::class), $di->g(PluginManager::class),
46
+    $di->g(ResponseManager::class), $di->g(CallbackManager::class),
47
+    $di->g(DatabagPlugin::class));
48
+});
49
+// Requests and calls Factory
50
+$this->set(CallFactory::class, function($di) {
51
+return new CallFactory($di->g(ComponentContainer::class), $di->g(DialogCommand::class));
52
+});
53
+// Factory for function parameters
54
+$this->set(ParameterFactory::class, function() {
55
+return new ParameterFactory();
56
+});
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * Get the callback manager
61 61
      *
62 62
      * @return CallbackManager
63 63
      */
64
-    public function callback(): CallbackManager
65
-    {
66
-        return $this->g(CallbackManager::class);
67
-    }
64
+public function callback(): CallbackManager
65
+{
66
+return $this->g(CallbackManager::class);
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * Get the js call factory
71 71
      *
72 72
      * @return CallFactory
73 73
      */
74
-    public function getCallFactory(): CallFactory
75
-    {
76
-        return $this->g(CallFactory::class);
77
-    }
74
+public function getCallFactory(): CallFactory
75
+{
76
+return $this->g(CallFactory::class);
77
+}
78 78
 
79
-    /**
79
+/**
80 80
      * Get the js call parameter factory
81 81
      *
82 82
      * @return ParameterFactory
83 83
      */
84
-    public function getParameterFactory(): ParameterFactory
85
-    {
86
-        return $this->g(ParameterFactory::class);
87
-    }
84
+public function getParameterFactory(): ParameterFactory
85
+{
86
+return $this->g(ParameterFactory::class);
87
+}
88 88
 
89
-    /**
89
+/**
90 90
      * Get the request handler
91 91
      *
92 92
      * @return RequestHandler
93 93
      */
94
-    public function getRequestHandler(): RequestHandler
95
-    {
96
-        return $this->g(RequestHandler::class);
97
-    }
94
+public function getRequestHandler(): RequestHandler
95
+{
96
+return $this->g(RequestHandler::class);
97
+}
98 98
 
99
-    /**
99
+/**
100 100
      * Get the upload handler
101 101
      *
102 102
      * @return UploadHandlerInterface|null
103 103
      */
104
-    public function getUploadHandler(): ?UploadHandlerInterface
105
-    {
106
-        return $this->g(UploadHandlerInterface::class);
107
-    }
104
+public function getUploadHandler(): ?UploadHandlerInterface
105
+{
106
+return $this->g(UploadHandlerInterface::class);
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Get the parameter reader
111 111
      *
112 112
      * @return ParameterReader
113 113
      */
114
-    public function getParameterReader(): ParameterReader
115
-    {
116
-        return $this->g(ParameterReader::class);
117
-    }
114
+public function getParameterReader(): ParameterReader
115
+{
116
+return $this->g(ParameterReader::class);
117
+}
118 118
 }
Please login to merge, or discard this patch.