Passed
Push — main ( 4ddaea...7c5fe7 )
by Thierry
04:58
created
jaxon-core/templates/plugins/wrapper.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@
 block discarded – undo
1
-<?php if(($this->sScript)): ?>
1
+<?php if (($this->sScript)): ?>
2 2
 <script type="text/javascript" <?php echo $this->sJsOptions ?> charset="UTF-8">
3 3
 /* <![CDATA[ */
4 4
 <?php echo $this->sScript, "\n" ?>
Please login to merge, or discard this patch.
jaxon-core/templates/plugins/includes.js.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,3 +1,3 @@
 block discarded – undo
1
-<?php foreach($this->aUrls as $sUrl):
1
+<?php foreach ($this->aUrls as $sUrl):
2 2
 $this->include('jaxon::plugins/include.js', ['sUrl' => $sUrl, 'sJsOptions' => $this->sJsOptions]);
3 3
 endforeach;
Please login to merge, or discard this patch.
jaxon-core/src/Di/Container.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@
 block discarded – undo
237 237
      */
238 238
     public function val(string $sKey, $xValue)
239 239
     {
240
-       $this->xLibContainer->offsetSet($sKey, $xValue);
240
+        $this->xLibContainer->offsetSet($sKey, $xValue);
241 241
     }
242 242
 
243 243
     /**
Please login to merge, or discard this patch.
Switch Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -32,145 +32,145 @@  discard block
 block discarded – undo
32 32
 
33 33
 class Container
34 34
 {
35
-    use Traits\AppTrait;
36
-    use Traits\PsrTrait;
37
-    use Traits\RequestTrait;
38
-    use Traits\ResponseTrait;
39
-    use Traits\PluginTrait;
40
-    use Traits\CallableTrait;
41
-    use Traits\ViewTrait;
42
-    use Traits\UtilTrait;
43
-    use Traits\MetadataTrait;
44
-    use Traits\DiAutoTrait;
35
+use Traits\AppTrait;
36
+use Traits\PsrTrait;
37
+use Traits\RequestTrait;
38
+use Traits\ResponseTrait;
39
+use Traits\PluginTrait;
40
+use Traits\CallableTrait;
41
+use Traits\ViewTrait;
42
+use Traits\UtilTrait;
43
+use Traits\MetadataTrait;
44
+use Traits\DiAutoTrait;
45 45
 
46
-    /**
46
+/**
47 47
      * The library Dependency Injection Container
48 48
      *
49 49
      * @var PimpleContainer
50 50
      */
51
-    private $xLibContainer;
51
+private $xLibContainer;
52 52
 
53
-    /**
53
+/**
54 54
      * The application or framework Dependency Injection Container
55 55
      *
56 56
      * @var ContainerInterface
57 57
      */
58
-    private $xAppContainer = null;
58
+private $xAppContainer = null;
59 59
 
60
-    /**
60
+/**
61 61
      * The class constructor
62 62
      */
63
-    public function __construct()
64
-    {
65
-        $this->xLibContainer = new PimpleContainer();
63
+public function __construct()
64
+{
65
+$this->xLibContainer = new PimpleContainer();
66 66
 
67
-        $this->val(Container::class, $this);
67
+$this->val(Container::class, $this);
68 68
 
69
-        // Register the null logger by default
70
-        $this->setLogger(new NullLogger());
69
+// Register the null logger by default
70
+$this->setLogger(new NullLogger());
71 71
 
72
-        // Template directory
73
-        $sTemplateDir = realpath(__DIR__ . '/../../templates');
74
-        $this->val('jaxon.core.dir.template', $sTemplateDir);
72
+// Template directory
73
+$sTemplateDir = realpath(__DIR__ . '/../../templates');
74
+$this->val('jaxon.core.dir.template', $sTemplateDir);
75 75
 
76
-        // Translation directory
77
-        $sTranslationDir = realpath(__DIR__ . '/../../translations');
78
-        $this->val('jaxon.core.dir.translation', $sTranslationDir);
76
+// Translation directory
77
+$sTranslationDir = realpath(__DIR__ . '/../../translations');
78
+$this->val('jaxon.core.dir.translation', $sTranslationDir);
79 79
 
80
-        $this->registerAll();
81
-        $this->setEventHandlers();
82
-    }
80
+$this->registerAll();
81
+$this->setEventHandlers();
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * The container for parameters
86 86
      *
87 87
      * @return Container
88 88
      */
89
-    protected function cn(): Container
90
-    {
91
-        return $this;
92
-    }
89
+protected function cn(): Container
90
+{
91
+return $this;
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Register the values into the container
96 96
      *
97 97
      * @return void
98 98
      */
99
-    private function registerAll()
100
-    {
101
-        $this->registerApp();
102
-        $this->registerPsr();
103
-        $this->registerRequests();
104
-        $this->registerResponses();
105
-        $this->registerPlugins();
106
-        $this->registerCallables();
107
-        $this->registerViews();
108
-        $this->registerUtils();
109
-        $this->registerMetadataReader();
110
-    }
99
+private function registerAll()
100
+{
101
+$this->registerApp();
102
+$this->registerPsr();
103
+$this->registerRequests();
104
+$this->registerResponses();
105
+$this->registerPlugins();
106
+$this->registerCallables();
107
+$this->registerViews();
108
+$this->registerUtils();
109
+$this->registerMetadataReader();
110
+}
111 111
 
112
-    /**
112
+/**
113 113
      * Set the logger
114 114
      *
115 115
      * @param LoggerInterface|Closure $xLogger
116 116
      *
117 117
      * @return void
118 118
      */
119
-    public function setLogger(LoggerInterface|Closure $xLogger)
120
-    {
121
-        is_a($xLogger, LoggerInterface::class) ?
122
-            $this->val(LoggerInterface::class, $xLogger) :
123
-            $this->set(LoggerInterface::class, $xLogger);
124
-    }
119
+public function setLogger(LoggerInterface|Closure $xLogger)
120
+{
121
+is_a($xLogger, LoggerInterface::class) ?
122
+$this->val(LoggerInterface::class, $xLogger) :
123
+$this->set(LoggerInterface::class, $xLogger);
124
+}
125 125
 
126
-    /**
126
+/**
127 127
      * Get the logger
128 128
      *
129 129
      * @return LoggerInterface
130 130
      */
131
-    public function getLogger(): LoggerInterface
132
-    {
133
-        return $this->get(LoggerInterface::class);
134
-    }
131
+public function getLogger(): LoggerInterface
132
+{
133
+return $this->get(LoggerInterface::class);
134
+}
135 135
 
136
-    /**
136
+/**
137 137
      * Set the container provided by the integrated framework
138 138
      *
139 139
      * @param ContainerInterface $xContainer    The container implementation
140 140
      *
141 141
      * @return void
142 142
      */
143
-    public function setContainer(ContainerInterface $xContainer)
144
-    {
145
-        $this->xAppContainer = $xContainer;
146
-    }
143
+public function setContainer(ContainerInterface $xContainer)
144
+{
145
+$this->xAppContainer = $xContainer;
146
+}
147 147
 
148
-    /**
148
+/**
149 149
      * Check if a class is defined in the container
150 150
      *
151 151
      * @param string $sClass    The full class name
152 152
      *
153 153
      * @return bool
154 154
      */
155
-    public function h(string $sClass): bool
156
-    {
157
-        return $this->xLibContainer->offsetExists($sClass);
158
-    }
155
+public function h(string $sClass): bool
156
+{
157
+return $this->xLibContainer->offsetExists($sClass);
158
+}
159 159
 
160
-    /**
160
+/**
161 161
      * Check if a class is defined in the container
162 162
      *
163 163
      * @param string $sClass    The full class name
164 164
      *
165 165
      * @return bool
166 166
      */
167
-    public function has(string $sClass): bool
168
-    {
169
-        return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
170
-            true : $this->xLibContainer->offsetExists($sClass);
171
-    }
167
+public function has(string $sClass): bool
168
+{
169
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
170
+true : $this->xLibContainer->offsetExists($sClass);
171
+}
172 172
 
173
-    /**
173
+/**
174 174
      * Get a class instance
175 175
      *
176 176
      * @template T
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
      *
179 179
      * @return T
180 180
      */
181
-    public function g(string $sClass): mixed
182
-    {
183
-        return $this->xLibContainer->offsetGet($sClass);
184
-    }
181
+public function g(string $sClass): mixed
182
+{
183
+return $this->xLibContainer->offsetGet($sClass);
184
+}
185 185
 
186
-    /**
186
+/**
187 187
      * Get a class instance
188 188
      *
189 189
      * @template T
@@ -192,24 +192,24 @@  discard block
 block discarded – undo
192 192
      * @return T
193 193
      * @throws SetupException
194 194
      */
195
-    public function get(string $sClass): mixed
196
-    {
197
-        try
198
-        {
199
-            return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
200
-                $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
201
-        }
202
-        catch(Throwable $e)
203
-        {
204
-            $xLogger = $this->g(LoggerInterface::class);
205
-            $xTranslator = $this->g(Translator::class);
206
-            $sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
207
-            $xLogger->error($e->getMessage(), ['message' => $sMessage]);
208
-            throw new SetupException($sMessage);
209
-        }
210
-    }
195
+public function get(string $sClass): mixed
196
+{
197
+try
198
+{
199
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
200
+    $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
201
+}
202
+catch(Throwable $e)
203
+{
204
+$xLogger = $this->g(LoggerInterface::class);
205
+$xTranslator = $this->g(Translator::class);
206
+$sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
207
+$xLogger->error($e->getMessage(), ['message' => $sMessage]);
208
+throw new SetupException($sMessage);
209
+}
210
+}
211 211
 
212
-    /**
212
+/**
213 213
      * Save a closure in the container
214 214
      *
215 215
      * @param string|class-string $sClass    The full class name
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
      *
219 219
      * @return void
220 220
      */
221
-    public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
222
-    {
223
-        // Wrap the user closure into a new closure, so it can take this container as a parameter.
224
-        $xClosure = fn() => $xClosure($this);
225
-        $this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
226
-            $xClosure : $this->xLibContainer->factory($xClosure));
227
-    }
221
+public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
222
+{
223
+// Wrap the user closure into a new closure, so it can take this container as a parameter.
224
+$xClosure = fn() => $xClosure($this);
225
+$this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
226
+$xClosure : $this->xLibContainer->factory($xClosure));
227
+}
228 228
 
229
-    /**
229
+/**
230 230
      * Save a value in the container
231 231
      *
232 232
      * @param string|class-string $sKey    The key
@@ -234,12 +234,12 @@  discard block
 block discarded – undo
234 234
      *
235 235
      * @return void
236 236
      */
237
-    public function val(string $sKey, $xValue)
238
-    {
239
-       $this->xLibContainer->offsetSet($sKey, $xValue);
240
-    }
237
+public function val(string $sKey, $xValue)
238
+{
239
+$this->xLibContainer->offsetSet($sKey, $xValue);
240
+}
241 241
 
242
-    /**
242
+/**
243 243
      * Set an alias in the container
244 244
      *
245 245
      * @param string|class-string $sAlias    The alias name
@@ -247,60 +247,60 @@  discard block
 block discarded – undo
247 247
      *
248 248
      * @return void
249 249
      */
250
-    public function alias(string $sAlias, string $sClass)
251
-    {
252
-        $this->set($sAlias, function($di) use ($sClass) {
253
-            return $di->get($sClass);
254
-        });
255
-    }
250
+public function alias(string $sAlias, string $sClass)
251
+{
252
+$this->set($sAlias, function($di) use ($sClass) {
253
+return $di->get($sClass);
254
+});
255
+}
256 256
 
257
-    /**
257
+/**
258 258
      * @param ReflectionClass $xClass
259 259
      * @param ReflectionParameter $xParameter
260 260
      *
261 261
      * @return mixed
262 262
      * @throws SetupException
263 263
      */
264
-    public function getParameter(ReflectionClass $xClass, ReflectionParameter $xParameter)
265
-    {
266
-        $xType = $xParameter->getType();
267
-        // Check the parameter class first.
268
-        if($xType instanceof ReflectionNamedType)
269
-        {
270
-            // Check the class + the name
271
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
272
-            {
273
-                return $this->get($xType->getName() . ' $' . $xParameter->getName());
274
-            }
275
-            // Check the class only
276
-            if($this->has($xType->getName()))
277
-            {
278
-                return $this->get($xType->getName());
279
-            }
280
-        }
281
-        // Check the name only
282
-        return $this->get('$' . $xParameter->getName());
283
-    }
264
+public function getParameter(ReflectionClass $xClass, ReflectionParameter $xParameter)
265
+{
266
+$xType = $xParameter->getType();
267
+// Check the parameter class first.
268
+if($xType instanceof ReflectionNamedType)
269
+{
270
+// Check the class + the name
271
+if($this->has($xType->getName() . ' $' . $xParameter->getName()))
272
+{
273
+    return $this->get($xType->getName() . ' $' . $xParameter->getName());
274
+}
275
+// Check the class only
276
+if($this->has($xType->getName()))
277
+{
278
+    return $this->get($xType->getName());
279
+}
280
+}
281
+// Check the name only
282
+return $this->get('$' . $xParameter->getName());
283
+}
284 284
 
285
-    /**
285
+/**
286 286
      * Get the session manager
287 287
      *
288 288
      * @return SessionInterface|null
289 289
      */
290
-    public function getSessionManager(): ?SessionInterface
291
-    {
292
-        return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
293
-    }
290
+public function getSessionManager(): ?SessionInterface
291
+{
292
+return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
293
+}
294 294
 
295
-    /**
295
+/**
296 296
      * Set the session manager
297 297
      *
298 298
      * @param Closure $xClosure    A closure to create the session manager instance
299 299
      *
300 300
      * @return void
301 301
      */
302
-    public function setSessionManager(Closure $xClosure)
303
-    {
304
-        $this->set(SessionInterface::class, $xClosure);
305
-    }
302
+public function setSessionManager(Closure $xClosure)
303
+{
304
+$this->set(SessionInterface::class, $xClosure);
305
+}
306 306
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -119,8 +119,7 @@  discard block
 block discarded – undo
119 119
     public function setLogger(LoggerInterface|Closure $xLogger)
120 120
     {
121 121
         is_a($xLogger, LoggerInterface::class) ?
122
-            $this->val(LoggerInterface::class, $xLogger) :
123
-            $this->set(LoggerInterface::class, $xLogger);
122
+            $this->val(LoggerInterface::class, $xLogger) : $this->set(LoggerInterface::class, $xLogger);
124 123
     }
125 124
 
126 125
     /**
@@ -199,7 +198,7 @@  discard block
 block discarded – undo
199 198
             return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
200 199
                 $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
201 200
         }
202
-        catch(Throwable $e)
201
+        catch (Throwable $e)
203 202
         {
204 203
             $xLogger = $this->g(LoggerInterface::class);
205 204
             $xTranslator = $this->g(Translator::class);
@@ -265,15 +264,15 @@  discard block
 block discarded – undo
265 264
     {
266 265
         $xType = $xParameter->getType();
267 266
         // Check the parameter class first.
268
-        if($xType instanceof ReflectionNamedType)
267
+        if ($xType instanceof ReflectionNamedType)
269 268
         {
270 269
             // Check the class + the name
271
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
270
+            if ($this->has($xType->getName() . ' $' . $xParameter->getName()))
272 271
             {
273 272
                 return $this->get($xType->getName() . ' $' . $xParameter->getName());
274 273
             }
275 274
             // Check the class only
276
-            if($this->has($xType->getName()))
275
+            if ($this->has($xType->getName()))
277 276
             {
278 277
                 return $this->get($xType->getName());
279 278
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,8 +198,7 @@
 block discarded – undo
198 198
         {
199 199
             return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
200 200
                 $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
201
-        }
202
-        catch(Throwable $e)
201
+        } catch(Throwable $e)
203 202
         {
204 203
             $xLogger = $this->g(LoggerInterface::class);
205 204
             $xTranslator = $this->g(Translator::class);
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/MetadataTrait.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,6 @@
 block discarded – undo
37 37
     public function getMetadataReader(string $sReaderId): MetadataReaderInterface
38 38
     {
39 39
         return $this->h("metadata_reader_$sReaderId") ?
40
-            $this->g("metadata_reader_$sReaderId") :
41
-            $this->g('metadata_reader_null');
40
+            $this->g("metadata_reader_$sReaderId") : $this->g('metadata_reader_null');
42 41
     }
43 42
 }
Please login to merge, or discard this patch.
Switch Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@
 block discarded – undo
9 9
 
10 10
 trait MetadataTrait
11 11
 {
12
-    /**
12
+/**
13 13
      * Register the values into the container
14 14
      *
15 15
      * @return void
16 16
      */
17
-    private function registerMetadataReader(): void
18
-    {
19
-        // Metadata cache
20
-        $this->set(MetadataCache::class, fn($di) =>
21
-            new MetadataCache($di->g('jaxon_metadata_cache_dir')));
17
+private function registerMetadataReader(): void
18
+{
19
+// Metadata cache
20
+$this->set(MetadataCache::class, fn($di) =>
21
+new MetadataCache($di->g('jaxon_metadata_cache_dir')));
22 22
 
23
-        // By default, register a fake metadata reader.
24
-        $this->set('metadata_reader_null', function() {
25
-            return new class implements MetadataReaderInterface
26
-            {
27
-                public function getAttributes(InputData $xInputData): Metadata
28
-                {
29
-                    return new Metadata();
30
-                }
31
-            };
32
-        });
23
+// By default, register a fake metadata reader.
24
+$this->set('metadata_reader_null', function() {
25
+return new class implements MetadataReaderInterface
26
+{
27
+    public function getAttributes(InputData $xInputData): Metadata
28
+    {
29
+        return new Metadata();
33 30
     }
31
+};
32
+});
33
+}
34 34
 
35
-    /**
35
+/**
36 36
      * Get the metadata cache
37 37
      *
38 38
      * @return MetadataCache
39 39
      */
40
-    public function getMetadataCache(): MetadataCache
41
-    {
42
-        return $this->g(MetadataCache::class);
43
-    }
40
+public function getMetadataCache(): MetadataCache
41
+{
42
+return $this->g(MetadataCache::class);
43
+}
44 44
 
45
-    /**
45
+/**
46 46
      * Get the metadata reader with the given id
47 47
      *
48 48
      * @param string $sReaderId
49 49
      *
50 50
      * @return MetadataReaderInterface
51 51
      */
52
-    public function getMetadataReader(string $sReaderId): MetadataReaderInterface
53
-    {
54
-        return $this->h("metadata_reader_$sReaderId") ?
55
-            $this->g("metadata_reader_$sReaderId") :
56
-            $this->g('metadata_reader_null');
57
-    }
52
+public function getMetadataReader(string $sReaderId): MetadataReaderInterface
53
+{
54
+return $this->h("metadata_reader_$sReaderId") ?
55
+$this->g("metadata_reader_$sReaderId") :
56
+$this->g('metadata_reader_null');
57
+}
58 58
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/DiAutoTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@
 block discarded – undo
42 42
      */
43 43
     public function make(string|ReflectionClass $xClass): mixed
44 44
     {
45
-        if(is_string($xClass))
45
+        if (is_string($xClass))
46 46
         {
47 47
             // Create the reflection class instance
48 48
             $xClass = new ReflectionClass($xClass);
49 49
         }
50 50
         // Use the Reflection class to get the parameters of the constructor
51
-        if(($constructor = $xClass->getConstructor()) === null)
51
+        if (($constructor = $xClass->getConstructor()) === null)
52 52
         {
53 53
             return $xClass->newInstance();
54 54
         }
Please login to merge, or discard this patch.
Switch Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
 
25 25
 trait DiAutoTrait
26 26
 {
27
-    /**
27
+/**
28 28
      * The container for parameters
29 29
      *
30 30
      * @return Container
31 31
      */
32
-    abstract protected function cn(): Container;
32
+abstract protected function cn(): Container;
33 33
 
34
-    /**
34
+/**
35 35
      * Create an instance of a class, getting the constructor parameters from the DI container
36 36
      *
37 37
      * @param class-string|ReflectionClass $xClass The class name or the reflection class
@@ -40,36 +40,36 @@  discard block
 block discarded – undo
40 40
      * @throws ReflectionException
41 41
      * @throws SetupException
42 42
      */
43
-    public function make(string|ReflectionClass $xClass): mixed
44
-    {
45
-        if(is_string($xClass))
46
-        {
47
-            // Create the reflection class instance
48
-            $xClass = new ReflectionClass($xClass);
49
-        }
50
-        // Use the Reflection class to get the parameters of the constructor
51
-        if(($constructor = $xClass->getConstructor()) === null)
52
-        {
53
-            return $xClass->newInstance();
54
-        }
43
+public function make(string|ReflectionClass $xClass): mixed
44
+{
45
+if(is_string($xClass))
46
+{
47
+// Create the reflection class instance
48
+$xClass = new ReflectionClass($xClass);
49
+}
50
+// Use the Reflection class to get the parameters of the constructor
51
+if(($constructor = $xClass->getConstructor()) === null)
52
+{
53
+return $xClass->newInstance();
54
+}
55 55
 
56
-        $aParameters = array_map(function($xParameter) use($xClass) {
57
-            return $this->cn()->getParameter($xClass, $xParameter);
58
-        }, $constructor->getParameters());
59
-        return $xClass->newInstanceArgs($aParameters);
60
-    }
56
+$aParameters = array_map(function($xParameter) use($xClass) {
57
+return $this->cn()->getParameter($xClass, $xParameter);
58
+}, $constructor->getParameters());
59
+return $xClass->newInstanceArgs($aParameters);
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * Create an instance of a class by automatically fetching the dependencies in the constructor.
64 64
      *
65 65
      * @param class-string $sClass    The class name
66 66
      *
67 67
      * @return void
68 68
      */
69
-    public function auto(string $sClass): void
70
-    {
71
-        $this->set($sClass, function() use ($sClass) {
72
-            return $this->make($sClass);
73
-        });
74
-    }
69
+public function auto(string $sClass): void
70
+{
71
+$this->set($sClass, function() use ($sClass) {
72
+return $this->make($sClass);
73
+});
74
+}
75 75
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/PsrTrait.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
             $xParameterReader = $di->g(ParameterReader::class);
59 59
             $xRequest = $di->g(ServerRequestInterface::class);
60 60
             $aRequestParameter = $xParameterReader->getRequestParameter($xRequest);
61
-            return !is_array($aRequestParameter) ? $xRequest :
62
-                $xRequest->withAttribute('jxncall', $aRequestParameter);
61
+            return !is_array($aRequestParameter) ? $xRequest : $xRequest->withAttribute('jxncall', $aRequestParameter);
63 62
         });
64 63
         // PSR factory
65 64
         $this->set(PsrFactory::class, function($di) {
Please login to merge, or discard this patch.
Switch Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -20,152 +20,152 @@
 block discarded – undo
20 20
 
21 21
 trait PsrTrait
22 22
 {
23
-    /**
23
+/**
24 24
      * @var string
25 25
      */
26
-    private $sPsrConfig = 'jaxon.psr.config.file';
26
+private $sPsrConfig = 'jaxon.psr.config.file';
27 27
 
28
-    /**
28
+/**
29 29
      * @var string
30 30
      */
31
-    private $sPsrServerRequest = 'jaxon.psr.server.request';
31
+private $sPsrServerRequest = 'jaxon.psr.server.request';
32 32
 
33
-    /**
33
+/**
34 34
      * Register the values into the container
35 35
      *
36 36
      * @return void
37 37
      */
38
-    private function registerPsr(): void
39
-    {
40
-        // The server request
41
-        $this->set(Psr17Factory::class, function() {
42
-            return new Psr17Factory();
43
-        });
44
-        $this->set(ServerRequestCreator::class, function($di) {
45
-            $xPsr17Factory = $di->g(Psr17Factory::class);
46
-            return new ServerRequestCreator(
47
-                $xPsr17Factory, // ServerRequestFactory
48
-                $xPsr17Factory, // UriFactory
49
-                $xPsr17Factory, // UploadedFileFactory
50
-                $xPsr17Factory, // StreamFactory
51
-            );
52
-        });
53
-        $this->set(ServerRequestInterface::class, function($di) {
54
-            return $di->g(ServerRequestCreator::class)->fromGlobals();
55
-        });
56
-        // Server request with the Jaxon request parameter as attribute
57
-        $this->set($this->sPsrServerRequest, function($di) {
58
-            $xParameterReader = $di->g(ParameterReader::class);
59
-            $xRequest = $di->g(ServerRequestInterface::class);
60
-            $aRequestParameter = $xParameterReader->getRequestParameter($xRequest);
61
-            return !is_array($aRequestParameter) ? $xRequest :
62
-                $xRequest->withAttribute('jxncall', $aRequestParameter);
63
-        });
64
-        // PSR factory
65
-        $this->set(PsrFactory::class, function($di) {
66
-            return new PsrFactory($di->g(Container::class));
67
-        });
68
-        // PSR request handler
69
-        $this->set(PsrRequestHandler::class, function($di) {
70
-            return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
71
-                $di->g(ResponseManager::class), $di->g(Translator::class));
72
-        });
73
-        // PSR config middleware
74
-        $this->set(PsrConfigMiddleware::class, function($di) {
75
-            return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
76
-        });
77
-        // PSR ajax middleware
78
-        $this->set(PsrAjaxMiddleware::class, function($di) {
79
-            return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
80
-                $di->g(ResponseManager::class));
81
-        });
82
-        // The PSR response plugin
83
-        $this->set(PsrPlugin::class, function($di) {
84
-            return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
85
-        });
86
-    }
38
+private function registerPsr(): void
39
+{
40
+// The server request
41
+$this->set(Psr17Factory::class, function() {
42
+return new Psr17Factory();
43
+});
44
+$this->set(ServerRequestCreator::class, function($di) {
45
+$xPsr17Factory = $di->g(Psr17Factory::class);
46
+return new ServerRequestCreator(
47
+    $xPsr17Factory, // ServerRequestFactory
48
+    $xPsr17Factory, // UriFactory
49
+    $xPsr17Factory, // UploadedFileFactory
50
+    $xPsr17Factory, // StreamFactory
51
+);
52
+});
53
+$this->set(ServerRequestInterface::class, function($di) {
54
+return $di->g(ServerRequestCreator::class)->fromGlobals();
55
+});
56
+// Server request with the Jaxon request parameter as attribute
57
+$this->set($this->sPsrServerRequest, function($di) {
58
+$xParameterReader = $di->g(ParameterReader::class);
59
+$xRequest = $di->g(ServerRequestInterface::class);
60
+$aRequestParameter = $xParameterReader->getRequestParameter($xRequest);
61
+return !is_array($aRequestParameter) ? $xRequest :
62
+    $xRequest->withAttribute('jxncall', $aRequestParameter);
63
+});
64
+// PSR factory
65
+$this->set(PsrFactory::class, function($di) {
66
+return new PsrFactory($di->g(Container::class));
67
+});
68
+// PSR request handler
69
+$this->set(PsrRequestHandler::class, function($di) {
70
+return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
71
+    $di->g(ResponseManager::class), $di->g(Translator::class));
72
+});
73
+// PSR config middleware
74
+$this->set(PsrConfigMiddleware::class, function($di) {
75
+return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
76
+});
77
+// PSR ajax middleware
78
+$this->set(PsrAjaxMiddleware::class, function($di) {
79
+return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
80
+    $di->g(ResponseManager::class));
81
+});
82
+// The PSR response plugin
83
+$this->set(PsrPlugin::class, function($di) {
84
+return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
85
+});
86
+}
87 87
 
88
-    /**
88
+/**
89 89
      * Get the request
90 90
      *
91 91
      * @return array
92 92
      */
93
-    public function getServerParams(): array
94
-    {
95
-        $xRequest = $this->g(ServerRequestInterface::class);
96
-        return $xRequest->getServerParams();
97
-    }
93
+public function getServerParams(): array
94
+{
95
+$xRequest = $this->g(ServerRequestInterface::class);
96
+return $xRequest->getServerParams();
97
+}
98 98
 
99
-    /**
99
+/**
100 100
      * Get the request with Jaxon parameter as attribute
101 101
      *
102 102
      * @return ServerRequestInterface
103 103
      */
104
-    public function getRequest(): ServerRequestInterface
105
-    {
106
-        return $this->g($this->sPsrServerRequest);
107
-    }
104
+public function getRequest(): ServerRequestInterface
105
+{
106
+return $this->g($this->sPsrServerRequest);
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Return the array of arguments from the GET or POST data
111 111
      *
112 112
      * @return array
113 113
      */
114
-    public function getRequestArguments(): array
115
-    {
116
-        return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
117
-    }
114
+public function getRequestArguments(): array
115
+{
116
+return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
117
+}
118 118
 
119
-    /**
119
+/**
120 120
      * Get the PSR factory
121 121
      *
122 122
      * @return PsrFactory
123 123
      */
124
-    public function getPsrFactory(): PsrFactory
125
-    {
126
-        return $this->g(PsrFactory::class);
127
-    }
124
+public function getPsrFactory(): PsrFactory
125
+{
126
+return $this->g(PsrFactory::class);
127
+}
128 128
 
129
-    /**
129
+/**
130 130
      * Get the Psr17 factory
131 131
      *
132 132
      * @return Psr17Factory
133 133
      */
134
-    public function getPsr17Factory(): Psr17Factory
135
-    {
136
-        return $this->g(Psr17Factory::class);
137
-    }
134
+public function getPsr17Factory(): Psr17Factory
135
+{
136
+return $this->g(Psr17Factory::class);
137
+}
138 138
 
139
-    /**
139
+/**
140 140
      * Get the PSR request handler
141 141
      *
142 142
      * @return PsrRequestHandler
143 143
      */
144
-    public function getPsrRequestHandler(): PsrRequestHandler
145
-    {
146
-        return $this->g(PsrRequestHandler::class);
147
-    }
144
+public function getPsrRequestHandler(): PsrRequestHandler
145
+{
146
+return $this->g(PsrRequestHandler::class);
147
+}
148 148
 
149
-    /**
149
+/**
150 150
      * Get the PSR config middleware
151 151
      *
152 152
      * @param string $sConfigFile
153 153
      *
154 154
      * @return PsrConfigMiddleware
155 155
      */
156
-    public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
157
-    {
158
-        !$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
159
-        return $this->g(PsrConfigMiddleware::class);
160
-    }
156
+public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
157
+{
158
+!$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
159
+return $this->g(PsrConfigMiddleware::class);
160
+}
161 161
 
162
-    /**
162
+/**
163 163
      * Get the PSR ajax request middleware
164 164
      *
165 165
      * @return PsrAjaxMiddleware
166 166
      */
167
-    public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
168
-    {
169
-        return $this->g(PsrAjaxMiddleware::class);
170
-    }
167
+public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
168
+{
169
+return $this->g(PsrAjaxMiddleware::class);
170
+}
171 171
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/PluginTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     public function registerPackage(string $sClassName, array $aUserOptions): void
194 194
     {
195 195
         // Register the user class, but only if the user didn't already.
196
-        if(!$this->h($sClassName))
196
+        if (!$this->h($sClassName))
197 197
         {
198 198
             $this->set($sClassName, fn() => $this->make($sClassName));
199 199
         }
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         $this->set($sConfigKey, function($di) use($aUserOptions) {
204 204
             $xOptionsProvider = $aUserOptions['provider'] ?? null;
205 205
             // The user can provide a callable that returns the package options.
206
-            if(is_callable($xOptionsProvider))
206
+            if (is_callable($xOptionsProvider))
207 207
             {
208 208
                 $aUserOptions = $xOptionsProvider($aUserOptions);
209 209
             }
Please login to merge, or discard this patch.
Switch Indentation   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -35,154 +35,154 @@  discard block
 block discarded – undo
35 35
 
36 36
 trait PluginTrait
37 37
 {
38
-    /**
38
+/**
39 39
      * Register the values into the container
40 40
      *
41 41
      * @return void
42 42
      */
43
-    private function registerPlugins(): void
44
-    {
45
-        // Plugin manager
46
-        $this->set(PluginManager::class, function($di) {
47
-            $xPluginManager = new PluginManager($di->g(Container::class),
48
-                $di->g(CodeGenerator::class), $di->g(Translator::class));
49
-            // Register the Jaxon request and response plugins
50
-            $xPluginManager->registerPlugins();
51
-            return $xPluginManager;
52
-        });
53
-        // Package manager
54
-        $this->set(PackageManager::class, function($di) {
55
-            return new PackageManager($di->g(Container::class), $di->g(Translator::class),
56
-                $di->g(PluginManager::class), $di->g(ConfigManager::class),
57
-                $di->g(CodeGenerator::class), $di->g(ViewRenderer::class),
58
-                $di->g(CallbackManager::class), $di->g(ComponentRegistry::class));
59
-        });
60
-        // Code Generation
61
-        $this->set(MinifierInterface::class, function() {
62
-            return new class extends FileMinifier implements MinifierInterface
63
-            {};
64
-        });
65
-        $this->set(AssetManager::class, function($di) {
66
-            return new AssetManager($di->g(ConfigManager::class),
67
-                $di->g(MinifierInterface::class));
68
-        });
69
-        $this->set(CodeGenerator::class, function($di) {
70
-            return new CodeGenerator(Jaxon::VERSION, $di->g(Container::class),
71
-                $di->g(TemplateEngine::class));
72
-        });
73
-        $this->set(ConfigScriptGenerator::class, function($di) {
74
-            return new ConfigScriptGenerator($di->g(ParameterReader::class),
75
-                $di->g(TemplateEngine::class), $di->g(ConfigManager::class));
76
-        });
77
-        $this->set(ReadyScriptGenerator::class, function($di) {
78
-            return new ReadyScriptGenerator();
79
-        });
80
-
81
-        // Script response plugin
82
-        $this->set(ScriptPlugin::class, function($di) {
83
-            return new ScriptPlugin($di->g(CallFactory::class));
84
-        });
85
-        // Databag response plugin
86
-        $this->set(DatabagPlugin::class, function($di) {
87
-            return new DatabagPlugin($di->g(Container::class));
88
-        });
89
-        // Dialog response plugin
90
-        $this->set(DialogPlugin::class, function($di) {
91
-            return new DialogPlugin($di->g(DialogCommand::class));
92
-        });
93
-        // Paginator response plugin
94
-        $this->set(PaginatorPlugin::class, function($di) {
95
-            return new PaginatorPlugin($di->g(RendererInterface::class));
96
-        });
97
-    }
98
-
99
-    /**
43
+private function registerPlugins(): void
44
+{
45
+// Plugin manager
46
+$this->set(PluginManager::class, function($di) {
47
+$xPluginManager = new PluginManager($di->g(Container::class),
48
+    $di->g(CodeGenerator::class), $di->g(Translator::class));
49
+// Register the Jaxon request and response plugins
50
+$xPluginManager->registerPlugins();
51
+return $xPluginManager;
52
+});
53
+// Package manager
54
+$this->set(PackageManager::class, function($di) {
55
+return new PackageManager($di->g(Container::class), $di->g(Translator::class),
56
+    $di->g(PluginManager::class), $di->g(ConfigManager::class),
57
+    $di->g(CodeGenerator::class), $di->g(ViewRenderer::class),
58
+    $di->g(CallbackManager::class), $di->g(ComponentRegistry::class));
59
+});
60
+// Code Generation
61
+$this->set(MinifierInterface::class, function() {
62
+return new class extends FileMinifier implements MinifierInterface
63
+{};
64
+});
65
+$this->set(AssetManager::class, function($di) {
66
+return new AssetManager($di->g(ConfigManager::class),
67
+    $di->g(MinifierInterface::class));
68
+});
69
+$this->set(CodeGenerator::class, function($di) {
70
+return new CodeGenerator(Jaxon::VERSION, $di->g(Container::class),
71
+    $di->g(TemplateEngine::class));
72
+});
73
+$this->set(ConfigScriptGenerator::class, function($di) {
74
+return new ConfigScriptGenerator($di->g(ParameterReader::class),
75
+    $di->g(TemplateEngine::class), $di->g(ConfigManager::class));
76
+});
77
+$this->set(ReadyScriptGenerator::class, function($di) {
78
+return new ReadyScriptGenerator();
79
+});
80
+
81
+// Script response plugin
82
+$this->set(ScriptPlugin::class, function($di) {
83
+return new ScriptPlugin($di->g(CallFactory::class));
84
+});
85
+// Databag response plugin
86
+$this->set(DatabagPlugin::class, function($di) {
87
+return new DatabagPlugin($di->g(Container::class));
88
+});
89
+// Dialog response plugin
90
+$this->set(DialogPlugin::class, function($di) {
91
+return new DialogPlugin($di->g(DialogCommand::class));
92
+});
93
+// Paginator response plugin
94
+$this->set(PaginatorPlugin::class, function($di) {
95
+return new PaginatorPlugin($di->g(RendererInterface::class));
96
+});
97
+}
98
+
99
+/**
100 100
      * Get the plugin manager
101 101
      *
102 102
      * @return PluginManager
103 103
      */
104
-    public function getPluginManager(): PluginManager
105
-    {
106
-        return $this->g(PluginManager::class);
107
-    }
104
+public function getPluginManager(): PluginManager
105
+{
106
+return $this->g(PluginManager::class);
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Get the package manager
111 111
      *
112 112
      * @return PackageManager
113 113
      */
114
-    public function getPackageManager(): PackageManager
115
-    {
116
-        return $this->g(PackageManager::class);
117
-    }
114
+public function getPackageManager(): PackageManager
115
+{
116
+return $this->g(PackageManager::class);
117
+}
118 118
 
119
-    /**
119
+/**
120 120
      * Get the code generator
121 121
      *
122 122
      * @return CodeGenerator
123 123
      */
124
-    public function getCodeGenerator(): CodeGenerator
125
-    {
126
-        return $this->g(CodeGenerator::class);
127
-    }
124
+public function getCodeGenerator(): CodeGenerator
125
+{
126
+return $this->g(CodeGenerator::class);
127
+}
128 128
 
129
-    /**
129
+/**
130 130
      * Get the asset manager
131 131
      *
132 132
      * @return AssetManager
133 133
      */
134
-    public function getAssetManager(): AssetManager
135
-    {
136
-        return $this->g(AssetManager::class);
137
-    }
134
+public function getAssetManager(): AssetManager
135
+{
136
+return $this->g(AssetManager::class);
137
+}
138 138
 
139
-    /**
139
+/**
140 140
      * Get the jQuery plugin
141 141
      *
142 142
      * @return ScriptPlugin
143 143
      */
144
-    public function getScriptPlugin(): ScriptPlugin
145
-    {
146
-        return $this->g(ScriptPlugin::class);
147
-    }
144
+public function getScriptPlugin(): ScriptPlugin
145
+{
146
+return $this->g(ScriptPlugin::class);
147
+}
148 148
 
149
-    /**
149
+/**
150 150
      * Get the dialog plugin
151 151
      *
152 152
      * @return DialogPlugin
153 153
      */
154
-    public function getDialogPlugin(): DialogPlugin
155
-    {
156
-        return $this->g(DialogPlugin::class);
157
-    }
154
+public function getDialogPlugin(): DialogPlugin
155
+{
156
+return $this->g(DialogPlugin::class);
157
+}
158 158
 
159
-    /**
159
+/**
160 160
      * @param class-string $sClassName    The package class name
161 161
      *
162 162
      * @return string
163 163
      */
164
-    private function getPackageConfigKey(string $sClassName): string
165
-    {
166
-        return $sClassName . '_PackageConfig';
167
-    }
164
+private function getPackageConfigKey(string $sClassName): string
165
+{
166
+return $sClassName . '_PackageConfig';
167
+}
168 168
 
169
-    /**
169
+/**
170 170
      * @param class-string $sClassName    The package class name
171 171
      * @param-closure-this AbstractPackage $cSetter
172 172
      *
173 173
      * @return void
174 174
      */
175
-    private function extendPackage(string $sClassName, Closure $cSetter): void
176
-    {
177
-        // Initialize the package instance.
178
-        $this->xLibContainer->extend($sClassName, function($xPackage) use($cSetter) {
179
-            // Allow the setter to access protected attributes.
180
-            call_user_func($cSetter->bindTo($xPackage, $xPackage));
181
-            return $xPackage;
182
-        });
183
-    }
184
-
185
-    /**
175
+private function extendPackage(string $sClassName, Closure $cSetter): void
176
+{
177
+// Initialize the package instance.
178
+$this->xLibContainer->extend($sClassName, function($xPackage) use($cSetter) {
179
+// Allow the setter to access protected attributes.
180
+call_user_func($cSetter->bindTo($xPackage, $xPackage));
181
+return $xPackage;
182
+});
183
+}
184
+
185
+/**
186 186
      * Register a package
187 187
      *
188 188
      * @param class-string $sClassName    The package class name
@@ -191,45 +191,45 @@  discard block
 block discarded – undo
191 191
      * @return void
192 192
      * @throws SetupException
193 193
      */
194
-    public function registerPackage(string $sClassName, array $aUserOptions): void
195
-    {
196
-        // Register the user class, but only if the user didn't already.
197
-        if(!$this->h($sClassName))
198
-        {
199
-            $this->set($sClassName, fn() => $this->make($sClassName));
200
-        }
201
-
202
-        // Save the package config in the container.
203
-        $sConfigKey = $this->getPackageConfigKey($sClassName);
204
-        $this->set($sConfigKey, function($di) use($aUserOptions) {
205
-            $xOptionsProvider = $aUserOptions['provider'] ?? null;
206
-            // The user can provide a callable that returns the package options.
207
-            if(is_callable($xOptionsProvider))
208
-            {
209
-                $aUserOptions = $xOptionsProvider($aUserOptions);
210
-            }
211
-            return $di->g(ConfigManager::class)->newConfig($aUserOptions);
212
-        });
213
-
214
-        // Initialize the package instance.
215
-        $di = $this;
216
-        $this->extendPackage($sClassName, function() use($di, $sConfigKey) {
217
-            // $this here refers to the AbstractPackage instance.
218
-            $this->xPkgConfig = $di->g($sConfigKey);
219
-            $this->xRenderer = $di->g(ViewRenderer::class);
220
-            $this->init();
221
-        });
222
-    }
223
-
224
-    /**
194
+public function registerPackage(string $sClassName, array $aUserOptions): void
195
+{
196
+// Register the user class, but only if the user didn't already.
197
+if(!$this->h($sClassName))
198
+{
199
+$this->set($sClassName, fn() => $this->make($sClassName));
200
+}
201
+
202
+// Save the package config in the container.
203
+$sConfigKey = $this->getPackageConfigKey($sClassName);
204
+$this->set($sConfigKey, function($di) use($aUserOptions) {
205
+$xOptionsProvider = $aUserOptions['provider'] ?? null;
206
+// The user can provide a callable that returns the package options.
207
+if(is_callable($xOptionsProvider))
208
+{
209
+    $aUserOptions = $xOptionsProvider($aUserOptions);
210
+}
211
+return $di->g(ConfigManager::class)->newConfig($aUserOptions);
212
+});
213
+
214
+// Initialize the package instance.
215
+$di = $this;
216
+$this->extendPackage($sClassName, function() use($di, $sConfigKey) {
217
+// $this here refers to the AbstractPackage instance.
218
+$this->xPkgConfig = $di->g($sConfigKey);
219
+$this->xRenderer = $di->g(ViewRenderer::class);
220
+$this->init();
221
+});
222
+}
223
+
224
+/**
225 225
      * Get the config of a package
226 226
      *
227 227
      * @param class-string $sClassName    The package class name
228 228
      *
229 229
      * @return Config
230 230
      */
231
-    public function getPackageConfig(string $sClassName): Config
232
-    {
233
-        return $this->g($this->getPackageConfigKey($sClassName));
234
-    }
231
+public function getPackageConfig(string $sClassName): Config
232
+{
233
+return $this->g($this->getPackageConfigKey($sClassName));
234
+}
235 235
 }
Please login to merge, or discard this patch.
jaxon-core/src/Response/Manager/ResponseManager.php 2 patches
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
      */
187 187
     private function getCommandArgs(array|JsonSerializable $aArgs, bool $bRemoveEmpty = false): array
188 188
     {
189
-        if(!$bRemoveEmpty)
189
+        if (!$bRemoveEmpty)
190 190
         {
191 191
             return $aArgs;
192 192
         }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             'name' => $this->str($sName),
212 212
             'args' => $this->getCommandArgs($aArgs, $bRemoveEmpty),
213 213
         ]);
214
-        if($this->bOnConfirm)
214
+        if ($this->bOnConfirm)
215 215
         {
216 216
             $this->aConfirmCommands[] = $xCommand;
217 217
         }
@@ -240,14 +240,14 @@  discard block
 block discarded – undo
240 240
     public function addConfirmCommand(string $sName, Closure $fConfirm,
241 241
         string $sQuestion, array $aArgs = []): self
242 242
     {
243
-        if($this->bOnConfirm)
243
+        if ($this->bOnConfirm)
244 244
         {
245 245
             throw new AppException($this->xTranslator->trans('errors.app.confirm.nested'));
246 246
         }
247 247
         $this->bOnConfirm = true;
248 248
         $fConfirm();
249 249
         $this->bOnConfirm = false;
250
-        if(($nCommandCount = count($this->aConfirmCommands)) > 0)
250
+        if (($nCommandCount = count($this->aConfirmCommands)) > 0)
251 251
         {
252 252
             $aCommand = $this->di->getDialogCommand()->confirm($this->str($sQuestion), $aArgs);
253 253
             $aCommand['count'] = $nCommandCount;
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
      */
355 355
     public function printDebug()
356 356
     {
357
-        foreach($this->aDebugMessages as $sMessage)
357
+        foreach ($this->aDebugMessages as $sMessage)
358 358
         {
359 359
             $this->addCommand('script.debug', ['message' => $this->str($sMessage)]);
360 360
         }
@@ -368,8 +368,7 @@  discard block
 block discarded – undo
368 368
      */
369 369
     public function getContentType(): string
370 370
     {
371
-        return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() :
372
-            $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"';
371
+        return empty($this->sCharacterEncoding) ? $this->getResponse()->getContentType() : $this->getResponse()->getContentType() . '; charset="' . $this->sCharacterEncoding . '"';
373 372
     }
374 373
 
375 374
     /**
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -214,8 +214,7 @@
 block discarded – undo
214 214
         if($this->bOnConfirm)
215 215
         {
216 216
             $this->aConfirmCommands[] = $xCommand;
217
-        }
218
-        else
217
+        } else
219 218
         {
220 219
             $this->aCommands[] = $xCommand;
221 220
         }
Please login to merge, or discard this patch.
jaxon-core/src/Response/Manager/Command.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@
 block discarded – undo
66 66
      */
67 67
     public function setOption(string $sName, string|array|JsonSerializable $xValue): Command
68 68
     {
69
-        if(isset($this->aCommand['options']))
69
+        if (isset($this->aCommand['options']))
70 70
         {
71 71
             $this->aCommand['options'][$this->str($sName)] = $xValue;
72 72
             return $this;
Please login to merge, or discard this patch.