Passed
Push — main ( 7f530d...7aae9b )
by Thierry
05:54
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.
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -120,8 +120,7 @@  discard block
 block discarded – undo
120 120
     public function setLogger(LoggerInterface|Closure $xLogger)
121 121
     {
122 122
         is_a($xLogger, LoggerInterface::class) ?
123
-            $this->val(LoggerInterface::class, $xLogger) :
124
-            $this->set(LoggerInterface::class, $xLogger);
123
+            $this->val(LoggerInterface::class, $xLogger) : $this->set(LoggerInterface::class, $xLogger);
125 124
     }
126 125
 
127 126
     /**
@@ -200,7 +199,7 @@  discard block
 block discarded – undo
200 199
             return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
201 200
                 $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
202 201
         }
203
-        catch(Exception|Throwable $e)
202
+        catch (Exception|Throwable $e)
204 203
         {
205 204
             $xLogger = $this->g(LoggerInterface::class);
206 205
             $xTranslator = $this->g(Translator::class);
@@ -266,15 +265,15 @@  discard block
 block discarded – undo
266 265
     {
267 266
         $xType = $xParameter->getType();
268 267
         // Check the parameter class first.
269
-        if($xType instanceof ReflectionNamedType)
268
+        if ($xType instanceof ReflectionNamedType)
270 269
         {
271 270
             // Check the class + the name
272
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
271
+            if ($this->has($xType->getName() . ' $' . $xParameter->getName()))
273 272
             {
274 273
                 return $this->get($xType->getName() . ' $' . $xParameter->getName());
275 274
             }
276 275
             // Check the class only
277
-            if($this->has($xType->getName()))
276
+            if ($this->has($xType->getName()))
278 277
             {
279 278
                 return $this->get($xType->getName());
280 279
             }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -199,8 +199,7 @@
 block discarded – undo
199 199
         {
200 200
             return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
201 201
                 $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
202
-        }
203
-        catch(Exception|Throwable $e)
202
+        } catch(Exception|Throwable $e)
204 203
         {
205 204
             $xLogger = $this->g(LoggerInterface::class);
206 205
             $xTranslator = $this->g(Translator::class);
Please login to merge, or discard this patch.
Switch Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -33,145 +33,145 @@  discard block
 block discarded – undo
33 33
 
34 34
 class Container
35 35
 {
36
-    use Traits\AppTrait;
37
-    use Traits\PsrTrait;
38
-    use Traits\RequestTrait;
39
-    use Traits\ResponseTrait;
40
-    use Traits\PluginTrait;
41
-    use Traits\CallableTrait;
42
-    use Traits\ViewTrait;
43
-    use Traits\UtilTrait;
44
-    use Traits\MetadataTrait;
45
-    use Traits\DiAutoTrait;
36
+use Traits\AppTrait;
37
+use Traits\PsrTrait;
38
+use Traits\RequestTrait;
39
+use Traits\ResponseTrait;
40
+use Traits\PluginTrait;
41
+use Traits\CallableTrait;
42
+use Traits\ViewTrait;
43
+use Traits\UtilTrait;
44
+use Traits\MetadataTrait;
45
+use Traits\DiAutoTrait;
46 46
 
47
-    /**
47
+/**
48 48
      * The library Dependency Injection Container
49 49
      *
50 50
      * @var PimpleContainer
51 51
      */
52
-    private $xLibContainer;
52
+private $xLibContainer;
53 53
 
54
-    /**
54
+/**
55 55
      * The application or framework Dependency Injection Container
56 56
      *
57 57
      * @var ContainerInterface
58 58
      */
59
-    private $xAppContainer = null;
59
+private $xAppContainer = null;
60 60
 
61
-    /**
61
+/**
62 62
      * The class constructor
63 63
      */
64
-    public function __construct()
65
-    {
66
-        $this->xLibContainer = new PimpleContainer();
64
+public function __construct()
65
+{
66
+$this->xLibContainer = new PimpleContainer();
67 67
 
68
-        $this->val(Container::class, $this);
68
+$this->val(Container::class, $this);
69 69
 
70
-        // Register the null logger by default
71
-        $this->setLogger(new NullLogger());
70
+// Register the null logger by default
71
+$this->setLogger(new NullLogger());
72 72
 
73
-        // Template directory
74
-        $sTemplateDir = realpath(__DIR__ . '/../../templates');
75
-        $this->val('jaxon.core.dir.template', $sTemplateDir);
73
+// Template directory
74
+$sTemplateDir = realpath(__DIR__ . '/../../templates');
75
+$this->val('jaxon.core.dir.template', $sTemplateDir);
76 76
 
77
-        // Translation directory
78
-        $sTranslationDir = realpath(__DIR__ . '/../../translations');
79
-        $this->val('jaxon.core.dir.translation', $sTranslationDir);
77
+// Translation directory
78
+$sTranslationDir = realpath(__DIR__ . '/../../translations');
79
+$this->val('jaxon.core.dir.translation', $sTranslationDir);
80 80
 
81
-        $this->registerAll();
82
-        $this->setEventHandlers();
83
-    }
81
+$this->registerAll();
82
+$this->setEventHandlers();
83
+}
84 84
 
85
-    /**
85
+/**
86 86
      * The container for parameters
87 87
      *
88 88
      * @return Container
89 89
      */
90
-    protected function cn(): Container
91
-    {
92
-        return $this;
93
-    }
90
+protected function cn(): Container
91
+{
92
+return $this;
93
+}
94 94
 
95
-    /**
95
+/**
96 96
      * Register the values into the container
97 97
      *
98 98
      * @return void
99 99
      */
100
-    private function registerAll()
101
-    {
102
-        $this->registerApp();
103
-        $this->registerPsr();
104
-        $this->registerRequests();
105
-        $this->registerResponses();
106
-        $this->registerPlugins();
107
-        $this->registerCallables();
108
-        $this->registerViews();
109
-        $this->registerUtils();
110
-        $this->registerMetadataReader();
111
-    }
100
+private function registerAll()
101
+{
102
+$this->registerApp();
103
+$this->registerPsr();
104
+$this->registerRequests();
105
+$this->registerResponses();
106
+$this->registerPlugins();
107
+$this->registerCallables();
108
+$this->registerViews();
109
+$this->registerUtils();
110
+$this->registerMetadataReader();
111
+}
112 112
 
113
-    /**
113
+/**
114 114
      * Set the logger
115 115
      *
116 116
      * @param LoggerInterface|Closure $xLogger
117 117
      *
118 118
      * @return void
119 119
      */
120
-    public function setLogger(LoggerInterface|Closure $xLogger)
121
-    {
122
-        is_a($xLogger, LoggerInterface::class) ?
123
-            $this->val(LoggerInterface::class, $xLogger) :
124
-            $this->set(LoggerInterface::class, $xLogger);
125
-    }
120
+public function setLogger(LoggerInterface|Closure $xLogger)
121
+{
122
+is_a($xLogger, LoggerInterface::class) ?
123
+$this->val(LoggerInterface::class, $xLogger) :
124
+$this->set(LoggerInterface::class, $xLogger);
125
+}
126 126
 
127
-    /**
127
+/**
128 128
      * Get the logger
129 129
      *
130 130
      * @return LoggerInterface
131 131
      */
132
-    public function getLogger(): LoggerInterface
133
-    {
134
-        return $this->get(LoggerInterface::class);
135
-    }
132
+public function getLogger(): LoggerInterface
133
+{
134
+return $this->get(LoggerInterface::class);
135
+}
136 136
 
137
-    /**
137
+/**
138 138
      * Set the container provided by the integrated framework
139 139
      *
140 140
      * @param ContainerInterface $xContainer    The container implementation
141 141
      *
142 142
      * @return void
143 143
      */
144
-    public function setContainer(ContainerInterface $xContainer)
145
-    {
146
-        $this->xAppContainer = $xContainer;
147
-    }
144
+public function setContainer(ContainerInterface $xContainer)
145
+{
146
+$this->xAppContainer = $xContainer;
147
+}
148 148
 
149
-    /**
149
+/**
150 150
      * Check if a class is defined in the container
151 151
      *
152 152
      * @param string $sClass    The full class name
153 153
      *
154 154
      * @return bool
155 155
      */
156
-    public function h(string $sClass): bool
157
-    {
158
-        return $this->xLibContainer->offsetExists($sClass);
159
-    }
156
+public function h(string $sClass): bool
157
+{
158
+return $this->xLibContainer->offsetExists($sClass);
159
+}
160 160
 
161
-    /**
161
+/**
162 162
      * Check if a class is defined in the container
163 163
      *
164 164
      * @param string $sClass    The full class name
165 165
      *
166 166
      * @return bool
167 167
      */
168
-    public function has(string $sClass): bool
169
-    {
170
-        return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
171
-            true : $this->xLibContainer->offsetExists($sClass);
172
-    }
168
+public function has(string $sClass): bool
169
+{
170
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
171
+true : $this->xLibContainer->offsetExists($sClass);
172
+}
173 173
 
174
-    /**
174
+/**
175 175
      * Get a class instance
176 176
      *
177 177
      * @template T
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
      *
180 180
      * @return T
181 181
      */
182
-    public function g(string $sClass): mixed
183
-    {
184
-        return $this->xLibContainer->offsetGet($sClass);
185
-    }
182
+public function g(string $sClass): mixed
183
+{
184
+return $this->xLibContainer->offsetGet($sClass);
185
+}
186 186
 
187
-    /**
187
+/**
188 188
      * Get a class instance
189 189
      *
190 190
      * @template T
@@ -193,24 +193,24 @@  discard block
 block discarded – undo
193 193
      * @return T
194 194
      * @throws SetupException
195 195
      */
196
-    public function get(string $sClass): mixed
197
-    {
198
-        try
199
-        {
200
-            return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
201
-                $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
202
-        }
203
-        catch(Exception|Throwable $e)
204
-        {
205
-            $xLogger = $this->g(LoggerInterface::class);
206
-            $xTranslator = $this->g(Translator::class);
207
-            $sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
208
-            $xLogger->error($e->getMessage(), ['message' => $sMessage]);
209
-            throw new SetupException($sMessage);
210
-        }
211
-    }
196
+public function get(string $sClass): mixed
197
+{
198
+try
199
+{
200
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
201
+    $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
202
+}
203
+catch(Exception|Throwable $e)
204
+{
205
+$xLogger = $this->g(LoggerInterface::class);
206
+$xTranslator = $this->g(Translator::class);
207
+$sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
208
+$xLogger->error($e->getMessage(), ['message' => $sMessage]);
209
+throw new SetupException($sMessage);
210
+}
211
+}
212 212
 
213
-    /**
213
+/**
214 214
      * Save a closure in the container
215 215
      *
216 216
      * @param string|class-string $sClass    The full class name
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
      *
220 220
      * @return void
221 221
      */
222
-    public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
223
-    {
224
-        // Wrap the user closure into a new closure, so it can take this container as a parameter.
225
-        $xClosure = fn() => $xClosure($this);
226
-        $this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
227
-            $xClosure : $this->xLibContainer->factory($xClosure));
228
-    }
222
+public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
223
+{
224
+// Wrap the user closure into a new closure, so it can take this container as a parameter.
225
+$xClosure = fn() => $xClosure($this);
226
+$this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
227
+$xClosure : $this->xLibContainer->factory($xClosure));
228
+}
229 229
 
230
-    /**
230
+/**
231 231
      * Save a value in the container
232 232
      *
233 233
      * @param string|class-string $sKey    The key
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
      *
236 236
      * @return void
237 237
      */
238
-    public function val(string $sKey, $xValue)
239
-    {
240
-       $this->xLibContainer->offsetSet($sKey, $xValue);
241
-    }
238
+public function val(string $sKey, $xValue)
239
+{
240
+$this->xLibContainer->offsetSet($sKey, $xValue);
241
+}
242 242
 
243
-    /**
243
+/**
244 244
      * Set an alias in the container
245 245
      *
246 246
      * @param string|class-string $sAlias    The alias name
@@ -248,60 +248,60 @@  discard block
 block discarded – undo
248 248
      *
249 249
      * @return void
250 250
      */
251
-    public function alias(string $sAlias, string $sClass)
252
-    {
253
-        $this->set($sAlias, function($di) use ($sClass) {
254
-            return $di->get($sClass);
255
-        });
256
-    }
251
+public function alias(string $sAlias, string $sClass)
252
+{
253
+$this->set($sAlias, function($di) use ($sClass) {
254
+return $di->get($sClass);
255
+});
256
+}
257 257
 
258
-    /**
258
+/**
259 259
      * @param ReflectionClass $xClass
260 260
      * @param ReflectionParameter $xParameter
261 261
      *
262 262
      * @return mixed
263 263
      * @throws SetupException
264 264
      */
265
-    public function getParameter(ReflectionClass $xClass, ReflectionParameter $xParameter)
266
-    {
267
-        $xType = $xParameter->getType();
268
-        // Check the parameter class first.
269
-        if($xType instanceof ReflectionNamedType)
270
-        {
271
-            // Check the class + the name
272
-            if($this->has($xType->getName() . ' $' . $xParameter->getName()))
273
-            {
274
-                return $this->get($xType->getName() . ' $' . $xParameter->getName());
275
-            }
276
-            // Check the class only
277
-            if($this->has($xType->getName()))
278
-            {
279
-                return $this->get($xType->getName());
280
-            }
281
-        }
282
-        // Check the name only
283
-        return $this->get('$' . $xParameter->getName());
284
-    }
265
+public function getParameter(ReflectionClass $xClass, ReflectionParameter $xParameter)
266
+{
267
+$xType = $xParameter->getType();
268
+// Check the parameter class first.
269
+if($xType instanceof ReflectionNamedType)
270
+{
271
+// Check the class + the name
272
+if($this->has($xType->getName() . ' $' . $xParameter->getName()))
273
+{
274
+    return $this->get($xType->getName() . ' $' . $xParameter->getName());
275
+}
276
+// Check the class only
277
+if($this->has($xType->getName()))
278
+{
279
+    return $this->get($xType->getName());
280
+}
281
+}
282
+// Check the name only
283
+return $this->get('$' . $xParameter->getName());
284
+}
285 285
 
286
-    /**
286
+/**
287 287
      * Get the session manager
288 288
      *
289 289
      * @return SessionInterface|null
290 290
      */
291
-    public function getSessionManager(): ?SessionInterface
292
-    {
293
-        return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
294
-    }
291
+public function getSessionManager(): ?SessionInterface
292
+{
293
+return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
294
+}
295 295
 
296
-    /**
296
+/**
297 297
      * Set the session manager
298 298
      *
299 299
      * @param Closure $xClosure    A closure to create the session manager instance
300 300
      *
301 301
      * @return void
302 302
      */
303
-    public function setSessionManager(Closure $xClosure)
304
-    {
305
-        $this->set(SessionInterface::class, $xClosure);
306
-    }
303
+public function setSessionManager(Closure $xClosure)
304
+{
305
+$this->set(SessionInterface::class, $xClosure);
306
+}
307 307
 }
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
@@ -34,154 +34,154 @@  discard block
 block discarded – undo
34 34
 
35 35
 trait PluginTrait
36 36
 {
37
-    /**
37
+/**
38 38
      * Register the values into the container
39 39
      *
40 40
      * @return void
41 41
      */
42
-    private function registerPlugins(): void
43
-    {
44
-        // Plugin manager
45
-        $this->set(PluginManager::class, function($di) {
46
-            $xPluginManager = new PluginManager($di->g(Container::class),
47
-                $di->g(CodeGenerator::class), $di->g(Translator::class));
48
-            // Register the Jaxon request and response plugins
49
-            $xPluginManager->registerPlugins();
50
-            return $xPluginManager;
51
-        });
52
-        // Package manager
53
-        $this->set(PackageManager::class, function($di) {
54
-            return new PackageManager($di->g(Container::class), $di->g(Translator::class),
55
-                $di->g(PluginManager::class), $di->g(ConfigManager::class),
56
-                $di->g(CodeGenerator::class), $di->g(ViewRenderer::class),
57
-                $di->g(CallbackManager::class), $di->g(ComponentRegistry::class));
58
-        });
59
-        // Code Generation
60
-        $this->set(MinifierInterface::class, function() {
61
-            return new class extends FileMinifier implements MinifierInterface
62
-            {};
63
-        });
64
-        $this->set(AssetManager::class, function($di) {
65
-            return new AssetManager($di->g(ConfigManager::class),
66
-                $di->g(MinifierInterface::class));
67
-        });
68
-        $this->set(CodeGenerator::class, function($di) {
69
-            return new CodeGenerator(Jaxon::VERSION, $di->g(Container::class),
70
-                $di->g(TemplateEngine::class));
71
-        });
72
-        $this->set(ConfigScriptGenerator::class, function($di) {
73
-            return new ConfigScriptGenerator($di->g(ParameterReader::class),
74
-                $di->g(TemplateEngine::class), $di->g(ConfigManager::class));
75
-        });
76
-        $this->set(ReadyScriptGenerator::class, function($di) {
77
-            return new ReadyScriptGenerator();
78
-        });
79
-
80
-        // Script response plugin
81
-        $this->set(ScriptPlugin::class, function($di) {
82
-            return new ScriptPlugin($di->g(CallFactory::class));
83
-        });
84
-        // Databag response plugin
85
-        $this->set(DatabagPlugin::class, function($di) {
86
-            return new DatabagPlugin($di->g(Container::class));
87
-        });
88
-        // Dialog response plugin
89
-        $this->set(DialogPlugin::class, function($di) {
90
-            return new DialogPlugin($di->g(DialogCommand::class));
91
-        });
92
-        // Paginator response plugin
93
-        $this->set(PaginatorPlugin::class, function($di) {
94
-            return new PaginatorPlugin($di->g(RendererInterface::class));
95
-        });
96
-    }
97
-
98
-    /**
42
+private function registerPlugins(): void
43
+{
44
+// Plugin manager
45
+$this->set(PluginManager::class, function($di) {
46
+$xPluginManager = new PluginManager($di->g(Container::class),
47
+    $di->g(CodeGenerator::class), $di->g(Translator::class));
48
+// Register the Jaxon request and response plugins
49
+$xPluginManager->registerPlugins();
50
+return $xPluginManager;
51
+});
52
+// Package manager
53
+$this->set(PackageManager::class, function($di) {
54
+return new PackageManager($di->g(Container::class), $di->g(Translator::class),
55
+    $di->g(PluginManager::class), $di->g(ConfigManager::class),
56
+    $di->g(CodeGenerator::class), $di->g(ViewRenderer::class),
57
+    $di->g(CallbackManager::class), $di->g(ComponentRegistry::class));
58
+});
59
+// Code Generation
60
+$this->set(MinifierInterface::class, function() {
61
+return new class extends FileMinifier implements MinifierInterface
62
+{};
63
+});
64
+$this->set(AssetManager::class, function($di) {
65
+return new AssetManager($di->g(ConfigManager::class),
66
+    $di->g(MinifierInterface::class));
67
+});
68
+$this->set(CodeGenerator::class, function($di) {
69
+return new CodeGenerator(Jaxon::VERSION, $di->g(Container::class),
70
+    $di->g(TemplateEngine::class));
71
+});
72
+$this->set(ConfigScriptGenerator::class, function($di) {
73
+return new ConfigScriptGenerator($di->g(ParameterReader::class),
74
+    $di->g(TemplateEngine::class), $di->g(ConfigManager::class));
75
+});
76
+$this->set(ReadyScriptGenerator::class, function($di) {
77
+return new ReadyScriptGenerator();
78
+});
79
+
80
+// Script response plugin
81
+$this->set(ScriptPlugin::class, function($di) {
82
+return new ScriptPlugin($di->g(CallFactory::class));
83
+});
84
+// Databag response plugin
85
+$this->set(DatabagPlugin::class, function($di) {
86
+return new DatabagPlugin($di->g(Container::class));
87
+});
88
+// Dialog response plugin
89
+$this->set(DialogPlugin::class, function($di) {
90
+return new DialogPlugin($di->g(DialogCommand::class));
91
+});
92
+// Paginator response plugin
93
+$this->set(PaginatorPlugin::class, function($di) {
94
+return new PaginatorPlugin($di->g(RendererInterface::class));
95
+});
96
+}
97
+
98
+/**
99 99
      * Get the plugin manager
100 100
      *
101 101
      * @return PluginManager
102 102
      */
103
-    public function getPluginManager(): PluginManager
104
-    {
105
-        return $this->g(PluginManager::class);
106
-    }
103
+public function getPluginManager(): PluginManager
104
+{
105
+return $this->g(PluginManager::class);
106
+}
107 107
 
108
-    /**
108
+/**
109 109
      * Get the package manager
110 110
      *
111 111
      * @return PackageManager
112 112
      */
113
-    public function getPackageManager(): PackageManager
114
-    {
115
-        return $this->g(PackageManager::class);
116
-    }
113
+public function getPackageManager(): PackageManager
114
+{
115
+return $this->g(PackageManager::class);
116
+}
117 117
 
118
-    /**
118
+/**
119 119
      * Get the code generator
120 120
      *
121 121
      * @return CodeGenerator
122 122
      */
123
-    public function getCodeGenerator(): CodeGenerator
124
-    {
125
-        return $this->g(CodeGenerator::class);
126
-    }
123
+public function getCodeGenerator(): CodeGenerator
124
+{
125
+return $this->g(CodeGenerator::class);
126
+}
127 127
 
128
-    /**
128
+/**
129 129
      * Get the asset manager
130 130
      *
131 131
      * @return AssetManager
132 132
      */
133
-    public function getAssetManager(): AssetManager
134
-    {
135
-        return $this->g(AssetManager::class);
136
-    }
133
+public function getAssetManager(): AssetManager
134
+{
135
+return $this->g(AssetManager::class);
136
+}
137 137
 
138
-    /**
138
+/**
139 139
      * Get the jQuery plugin
140 140
      *
141 141
      * @return ScriptPlugin
142 142
      */
143
-    public function getScriptPlugin(): ScriptPlugin
144
-    {
145
-        return $this->g(ScriptPlugin::class);
146
-    }
143
+public function getScriptPlugin(): ScriptPlugin
144
+{
145
+return $this->g(ScriptPlugin::class);
146
+}
147 147
 
148
-    /**
148
+/**
149 149
      * Get the dialog plugin
150 150
      *
151 151
      * @return DialogPlugin
152 152
      */
153
-    public function getDialogPlugin(): DialogPlugin
154
-    {
155
-        return $this->g(DialogPlugin::class);
156
-    }
153
+public function getDialogPlugin(): DialogPlugin
154
+{
155
+return $this->g(DialogPlugin::class);
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * @param class-string $sClassName    The package class name
160 160
      *
161 161
      * @return string
162 162
      */
163
-    private function getPackageConfigKey(string $sClassName): string
164
-    {
165
-        return $sClassName . '_PackageConfig';
166
-    }
163
+private function getPackageConfigKey(string $sClassName): string
164
+{
165
+return $sClassName . '_PackageConfig';
166
+}
167 167
 
168
-    /**
168
+/**
169 169
      * @param class-string $sClassName    The package class name
170 170
      * @param-closure-this Package $cSetter
171 171
      *
172 172
      * @return void
173 173
      */
174
-    private function extendPackage(string $sClassName, Closure $cSetter): void
175
-    {
176
-        // Initialize the package instance.
177
-        $this->xLibContainer->extend($sClassName, function($xPackage) use($cSetter) {
178
-            // Allow the setter to access protected attributes.
179
-            call_user_func($cSetter->bindTo($xPackage, $xPackage));
180
-            return $xPackage;
181
-        });
182
-    }
183
-
184
-    /**
174
+private function extendPackage(string $sClassName, Closure $cSetter): void
175
+{
176
+// Initialize the package instance.
177
+$this->xLibContainer->extend($sClassName, function($xPackage) use($cSetter) {
178
+// Allow the setter to access protected attributes.
179
+call_user_func($cSetter->bindTo($xPackage, $xPackage));
180
+return $xPackage;
181
+});
182
+}
183
+
184
+/**
185 185
      * Register a package
186 186
      *
187 187
      * @param class-string $sClassName    The package class name
@@ -190,45 +190,45 @@  discard block
 block discarded – undo
190 190
      * @return void
191 191
      * @throws SetupException
192 192
      */
193
-    public function registerPackage(string $sClassName, array $aUserOptions): void
194
-    {
195
-        // Register the user class, but only if the user didn't already.
196
-        if(!$this->h($sClassName))
197
-        {
198
-            $this->set($sClassName, fn() => $this->make($sClassName));
199
-        }
200
-
201
-        // Save the package config in the container.
202
-        $sConfigKey = $this->getPackageConfigKey($sClassName);
203
-        $this->set($sConfigKey, function($di) use($aUserOptions) {
204
-            $xOptionsProvider = $aUserOptions['provider'] ?? null;
205
-            // The user can provide a callable that returns the package options.
206
-            if(is_callable($xOptionsProvider))
207
-            {
208
-                $aUserOptions = $xOptionsProvider($aUserOptions);
209
-            }
210
-            return $di->g(ConfigManager::class)->newConfig($aUserOptions);
211
-        });
212
-
213
-        // Initialize the package instance.
214
-        $di = $this;
215
-        $this->extendPackage($sClassName, function() use($di, $sConfigKey) {
216
-            // $this here refers to the Package instance.
217
-            $this->xPkgConfig = $di->g($sConfigKey);
218
-            $this->xRenderer = $di->g(ViewRenderer::class);
219
-            $this->init();
220
-        });
221
-    }
222
-
223
-    /**
193
+public function registerPackage(string $sClassName, array $aUserOptions): void
194
+{
195
+// Register the user class, but only if the user didn't already.
196
+if(!$this->h($sClassName))
197
+{
198
+$this->set($sClassName, fn() => $this->make($sClassName));
199
+}
200
+
201
+// Save the package config in the container.
202
+$sConfigKey = $this->getPackageConfigKey($sClassName);
203
+$this->set($sConfigKey, function($di) use($aUserOptions) {
204
+$xOptionsProvider = $aUserOptions['provider'] ?? null;
205
+// The user can provide a callable that returns the package options.
206
+if(is_callable($xOptionsProvider))
207
+{
208
+    $aUserOptions = $xOptionsProvider($aUserOptions);
209
+}
210
+return $di->g(ConfigManager::class)->newConfig($aUserOptions);
211
+});
212
+
213
+// Initialize the package instance.
214
+$di = $this;
215
+$this->extendPackage($sClassName, function() use($di, $sConfigKey) {
216
+// $this here refers to the Package instance.
217
+$this->xPkgConfig = $di->g($sConfigKey);
218
+$this->xRenderer = $di->g(ViewRenderer::class);
219
+$this->init();
220
+});
221
+}
222
+
223
+/**
224 224
      * Get the config of a package
225 225
      *
226 226
      * @param class-string $sClassName    The package class name
227 227
      *
228 228
      * @return Config
229 229
      */
230
-    public function getPackageConfig(string $sClassName): Config
231
-    {
232
-        return $this->g($this->getPackageConfigKey($sClassName));
233
-    }
230
+public function getPackageConfig(string $sClassName): Config
231
+{
232
+return $this->g($this->getPackageConfigKey($sClassName));
233
+}
234 234
 }
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.