Passed
Push — main ( 5ca287...d84479 )
by Thierry
05:24
created
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.
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.
Switch Indentation   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -29,145 +29,145 @@  discard block
 block discarded – undo
29 29
 
30 30
 class Container
31 31
 {
32
-    use Traits\AppTrait;
33
-    use Traits\PsrTrait;
34
-    use Traits\RequestTrait;
35
-    use Traits\ResponseTrait;
36
-    use Traits\PluginTrait;
37
-    use Traits\CallableTrait;
38
-    use Traits\ViewTrait;
39
-    use Traits\UtilTrait;
40
-    use Traits\MetadataTrait;
41
-    use Traits\DiAutoTrait;
32
+use Traits\AppTrait;
33
+use Traits\PsrTrait;
34
+use Traits\RequestTrait;
35
+use Traits\ResponseTrait;
36
+use Traits\PluginTrait;
37
+use Traits\CallableTrait;
38
+use Traits\ViewTrait;
39
+use Traits\UtilTrait;
40
+use Traits\MetadataTrait;
41
+use Traits\DiAutoTrait;
42 42
 
43
-    /**
43
+/**
44 44
      * The library Dependency Injection Container
45 45
      *
46 46
      * @var PimpleContainer
47 47
      */
48
-    private $xLibContainer;
48
+private $xLibContainer;
49 49
 
50
-    /**
50
+/**
51 51
      * The application or framework Dependency Injection Container
52 52
      *
53 53
      * @var ContainerInterface
54 54
      */
55
-    private $xAppContainer = null;
55
+private $xAppContainer = null;
56 56
 
57
-    /**
57
+/**
58 58
      * The class constructor
59 59
      */
60
-    public function __construct()
61
-    {
62
-        $this->xLibContainer = new PimpleContainer();
60
+public function __construct()
61
+{
62
+$this->xLibContainer = new PimpleContainer();
63 63
 
64
-        $this->val(Container::class, $this);
64
+$this->val(Container::class, $this);
65 65
 
66
-        // Register the null logger by default
67
-        $this->setLogger(new NullLogger());
66
+// Register the null logger by default
67
+$this->setLogger(new NullLogger());
68 68
 
69
-        // Template directory
70
-        $sTemplateDir = realpath(__DIR__ . '/../../templates');
71
-        $this->val('jaxon.core.dir.template', $sTemplateDir);
69
+// Template directory
70
+$sTemplateDir = realpath(__DIR__ . '/../../templates');
71
+$this->val('jaxon.core.dir.template', $sTemplateDir);
72 72
 
73
-        // Translation directory
74
-        $sTranslationDir = realpath(__DIR__ . '/../../translations');
75
-        $this->val('jaxon.core.dir.translation', $sTranslationDir);
73
+// Translation directory
74
+$sTranslationDir = realpath(__DIR__ . '/../../translations');
75
+$this->val('jaxon.core.dir.translation', $sTranslationDir);
76 76
 
77
-        $this->registerAll();
78
-        $this->setEventHandlers();
79
-    }
77
+$this->registerAll();
78
+$this->setEventHandlers();
79
+}
80 80
 
81
-    /**
81
+/**
82 82
      * The container for parameters
83 83
      *
84 84
      * @return Container
85 85
      */
86
-    protected function cn(): Container
87
-    {
88
-        return $this;
89
-    }
86
+protected function cn(): Container
87
+{
88
+return $this;
89
+}
90 90
 
91
-    /**
91
+/**
92 92
      * Register the values into the container
93 93
      *
94 94
      * @return void
95 95
      */
96
-    private function registerAll()
97
-    {
98
-        $this->registerApp();
99
-        $this->registerPsr();
100
-        $this->registerRequests();
101
-        $this->registerResponses();
102
-        $this->registerPlugins();
103
-        $this->registerCallables();
104
-        $this->registerViews();
105
-        $this->registerUtils();
106
-        $this->registerMetadataReader();
107
-    }
96
+private function registerAll()
97
+{
98
+$this->registerApp();
99
+$this->registerPsr();
100
+$this->registerRequests();
101
+$this->registerResponses();
102
+$this->registerPlugins();
103
+$this->registerCallables();
104
+$this->registerViews();
105
+$this->registerUtils();
106
+$this->registerMetadataReader();
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Set the logger
111 111
      *
112 112
      * @param LoggerInterface|Closure $xLogger
113 113
      *
114 114
      * @return void
115 115
      */
116
-    public function setLogger(LoggerInterface|Closure $xLogger)
117
-    {
118
-        is_a($xLogger, LoggerInterface::class) ?
119
-            $this->val(LoggerInterface::class, $xLogger) :
120
-            $this->set(LoggerInterface::class, $xLogger);
121
-    }
116
+public function setLogger(LoggerInterface|Closure $xLogger)
117
+{
118
+is_a($xLogger, LoggerInterface::class) ?
119
+$this->val(LoggerInterface::class, $xLogger) :
120
+$this->set(LoggerInterface::class, $xLogger);
121
+}
122 122
 
123
-    /**
123
+/**
124 124
      * Get the logger
125 125
      *
126 126
      * @return LoggerInterface
127 127
      */
128
-    public function getLogger(): LoggerInterface
129
-    {
130
-        return $this->get(LoggerInterface::class);
131
-    }
128
+public function getLogger(): LoggerInterface
129
+{
130
+return $this->get(LoggerInterface::class);
131
+}
132 132
 
133
-    /**
133
+/**
134 134
      * Set the container provided by the integrated framework
135 135
      *
136 136
      * @param ContainerInterface $xContainer    The container implementation
137 137
      *
138 138
      * @return void
139 139
      */
140
-    public function setContainer(ContainerInterface $xContainer)
141
-    {
142
-        $this->xAppContainer = $xContainer;
143
-    }
140
+public function setContainer(ContainerInterface $xContainer)
141
+{
142
+$this->xAppContainer = $xContainer;
143
+}
144 144
 
145
-    /**
145
+/**
146 146
      * Check if a class is defined in the container
147 147
      *
148 148
      * @param string $sClass    The full class name
149 149
      *
150 150
      * @return bool
151 151
      */
152
-    public function h(string $sClass): bool
153
-    {
154
-        return $this->xLibContainer->offsetExists($sClass);
155
-    }
152
+public function h(string $sClass): bool
153
+{
154
+return $this->xLibContainer->offsetExists($sClass);
155
+}
156 156
 
157
-    /**
157
+/**
158 158
      * Check if a class is defined in the container
159 159
      *
160 160
      * @param string $sClass    The full class name
161 161
      *
162 162
      * @return bool
163 163
      */
164
-    public function has(string $sClass): bool
165
-    {
166
-        return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
167
-            true : $this->xLibContainer->offsetExists($sClass);
168
-    }
164
+public function has(string $sClass): bool
165
+{
166
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
167
+true : $this->xLibContainer->offsetExists($sClass);
168
+}
169 169
 
170
-    /**
170
+/**
171 171
      * Get a class instance
172 172
      *
173 173
      * @template T
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @return T
177 177
      */
178
-    public function g(string $sClass): mixed
179
-    {
180
-        return $this->xLibContainer->offsetGet($sClass);
181
-    }
178
+public function g(string $sClass): mixed
179
+{
180
+return $this->xLibContainer->offsetGet($sClass);
181
+}
182 182
 
183
-    /**
183
+/**
184 184
      * Get a class instance
185 185
      *
186 186
      * @template T
@@ -189,24 +189,24 @@  discard block
 block discarded – undo
189 189
      * @return T
190 190
      * @throws SetupException
191 191
      */
192
-    public function get(string $sClass): mixed
193
-    {
194
-        try
195
-        {
196
-            return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
197
-                $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
198
-        }
199
-        catch(Throwable $e)
200
-        {
201
-            $xLogger = $this->g(LoggerInterface::class);
202
-            $xTranslator = $this->g(Translator::class);
203
-            $sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
204
-            $xLogger->error($e->getMessage(), ['message' => $sMessage]);
205
-            throw new SetupException($sMessage);
206
-        }
207
-    }
192
+public function get(string $sClass): mixed
193
+{
194
+try
195
+{
196
+return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
197
+    $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
198
+}
199
+catch(Throwable $e)
200
+{
201
+$xLogger = $this->g(LoggerInterface::class);
202
+$xTranslator = $this->g(Translator::class);
203
+$sMessage = $e->getMessage() . ': ' . $xTranslator->trans('errors.class.container', ['name' => $sClass]);
204
+$xLogger->error($e->getMessage(), ['message' => $sMessage]);
205
+throw new SetupException($sMessage);
206
+}
207
+}
208 208
 
209
-    /**
209
+/**
210 210
      * Save a closure in the container
211 211
      *
212 212
      * @param string|class-string $sClass    The full class name
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
      *
216 216
      * @return void
217 217
      */
218
-    public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
219
-    {
220
-        // Wrap the user closure into a new closure, so it can take this container as a parameter.
221
-        $xClosure = fn() => $xClosure($this);
222
-        $this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
223
-            $xClosure : $this->xLibContainer->factory($xClosure));
224
-    }
218
+public function set(string $sClass, Closure $xClosure, bool $bIsSingleton = true)
219
+{
220
+// Wrap the user closure into a new closure, so it can take this container as a parameter.
221
+$xClosure = fn() => $xClosure($this);
222
+$this->xLibContainer->offsetSet($sClass, $bIsSingleton ?
223
+$xClosure : $this->xLibContainer->factory($xClosure));
224
+}
225 225
 
226
-    /**
226
+/**
227 227
      * Save a value in the container
228 228
      *
229 229
      * @param string|class-string $sKey    The key
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
      *
232 232
      * @return void
233 233
      */
234
-    public function val(string $sKey, $xValue)
235
-    {
236
-       $this->xLibContainer->offsetSet($sKey, $xValue);
237
-    }
234
+public function val(string $sKey, $xValue)
235
+{
236
+$this->xLibContainer->offsetSet($sKey, $xValue);
237
+}
238 238
 
239
-    /**
239
+/**
240 240
      * Set an alias in the container
241 241
      *
242 242
      * @param string|class-string $sAlias    The alias name
@@ -244,32 +244,32 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @return void
246 246
      */
247
-    public function alias(string $sAlias, string $sClass)
248
-    {
249
-        $this->set($sAlias, function($di) use ($sClass) {
250
-            return $di->get($sClass);
251
-        });
252
-    }
247
+public function alias(string $sAlias, string $sClass)
248
+{
249
+$this->set($sAlias, function($di) use ($sClass) {
250
+return $di->get($sClass);
251
+});
252
+}
253 253
 
254
-    /**
254
+/**
255 255
      * Get the session manager
256 256
      *
257 257
      * @return SessionInterface|null
258 258
      */
259
-    public function getSessionManager(): ?SessionInterface
260
-    {
261
-        return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
262
-    }
259
+public function getSessionManager(): ?SessionInterface
260
+{
261
+return $this->h(SessionInterface::class) ? $this->g(SessionInterface::class) : null;
262
+}
263 263
 
264
-    /**
264
+/**
265 265
      * Set the session manager
266 266
      *
267 267
      * @param Closure $xClosure    A closure to create the session manager instance
268 268
      *
269 269
      * @return void
270 270
      */
271
-    public function setSessionManager(Closure $xClosure)
272
-    {
273
-        $this->set(SessionInterface::class, $xClosure);
274
-    }
271
+public function setSessionManager(Closure $xClosure)
272
+{
273
+$this->set(SessionInterface::class, $xClosure);
274
+}
275 275
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,8 +116,7 @@  discard block
 block discarded – undo
116 116
     public function setLogger(LoggerInterface|Closure $xLogger)
117 117
     {
118 118
         is_a($xLogger, LoggerInterface::class) ?
119
-            $this->val(LoggerInterface::class, $xLogger) :
120
-            $this->set(LoggerInterface::class, $xLogger);
119
+            $this->val(LoggerInterface::class, $xLogger) : $this->set(LoggerInterface::class, $xLogger);
121 120
     }
122 121
 
123 122
     /**
@@ -196,7 +195,7 @@  discard block
 block discarded – undo
196 195
             return $this->xAppContainer != null && $this->xAppContainer->has($sClass) ?
197 196
                 $this->xAppContainer->get($sClass) : $this->xLibContainer->offsetGet($sClass);
198 197
         }
199
-        catch(Throwable $e)
198
+        catch (Throwable $e)
200 199
         {
201 200
             $xLogger = $this->g(LoggerInterface::class);
202 201
             $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/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.
jaxon-core/src/Response/AbstractResponse.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -91,15 +91,15 @@
 block discarded – undo
91 91
         return $this->xManager->getErrorMessage();
92 92
     }
93 93
 
94
-     /**
95
-     * Add a response command to the array of commands
96
-     *
97
-     * @param string $sName    The command name
98
-     * @param array|JsonSerializable $aArgs    The command arguments
99
-     * @param bool $bRemoveEmpty
100
-     *
101
-     * @return Command
102
-     */
94
+        /**
95
+         * Add a response command to the array of commands
96
+         *
97
+         * @param string $sName    The command name
98
+         * @param array|JsonSerializable $aArgs    The command arguments
99
+         * @param bool $bRemoveEmpty
100
+         *
101
+         * @return Command
102
+         */
103 103
     public function addCommand(string $sName, array|JsonSerializable $aArgs = [],
104 104
         bool $bRemoveEmpty = false): Command
105 105
     {
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Manager/PackageManager.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -218,8 +218,7 @@
 block discarded – undo
218 218
         {
219 219
             // A string is supposed to be the path to a config file.
220 220
             $aLibOptions = $this->xConfigManager->read($aLibOptions);
221
-        }
222
-        elseif(!is_array($aLibOptions))
221
+        } elseif(!is_array($aLibOptions))
223 222
         {
224 223
             // Otherwise, anything else than an array is not accepted.
225 224
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,25 +62,25 @@  discard block
 block discarded – undo
62 62
     private function updateContainer(Config $xConfig): void
63 63
     {
64 64
         $aOptions = $xConfig->getOption('container.set', []);
65
-        foreach($aOptions as $xKey => $xValue)
65
+        foreach ($aOptions as $xKey => $xValue)
66 66
         {
67 67
             // The key is the class name. It must be a string.
68 68
             $this->di->set((string)$xKey, $xValue);
69 69
         }
70 70
         $aOptions = $xConfig->getOption('container.val', []);
71
-        foreach($aOptions as $xKey => $xValue)
71
+        foreach ($aOptions as $xKey => $xValue)
72 72
         {
73 73
             // The key is the class name. It must be a string.
74 74
             $this->di->val((string)$xKey, $xValue);
75 75
         }
76 76
         $aOptions = $xConfig->getOption('container.auto', []);
77
-        foreach($aOptions as $xValue)
77
+        foreach ($aOptions as $xValue)
78 78
         {
79 79
             // The key is the class name. It must be a string.
80 80
             $this->di->auto((string)$xValue);
81 81
         }
82 82
         $aOptions = $xConfig->getOption('container.alias', []);
83
-        foreach($aOptions as $xKey => $xValue)
83
+        foreach ($aOptions as $xKey => $xValue)
84 84
         {
85 85
             // The key is the class name. It must be a string.
86 86
             $this->di->alias((string)$xKey, (string)$xValue);
@@ -98,16 +98,16 @@  discard block
 block discarded – undo
98 98
      */
99 99
     private function registerCallables(array $aOptions, string $sCallableType): void
100 100
     {
101
-        foreach($aOptions as $xKey => $xValue)
101
+        foreach ($aOptions as $xKey => $xValue)
102 102
         {
103
-            if(is_integer($xKey) && is_string($xValue))
103
+            if (is_integer($xKey) && is_string($xValue))
104 104
             {
105 105
                 // Register a function without options
106 106
                 $this->xPluginManager->registerCallable($sCallableType, $xValue);
107 107
                 continue;
108 108
             }
109 109
 
110
-            if(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
110
+            if (is_string($xKey) && (is_array($xValue) || is_string($xValue)))
111 111
             {
112 112
                 // Register a function with options
113 113
                 $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      */
125 125
     private function registerExceptionHandlers(Config $xConfig): void
126 126
     {
127
-        foreach($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler)
127
+        foreach ($xConfig->getOption('exceptions', []) as $sExClass => $xExHandler)
128 128
         {
129 129
             $this->xCallbackManager->error($xExHandler, is_string($sExClass) ? $sExClass : '');
130 130
         }
@@ -147,20 +147,20 @@  discard block
 block discarded – undo
147 147
         // key of the array item, a string as the value of an entry without a key,
148 148
         // or set with the key $sOptionKey in an array entry without a key.
149 149
         $aCallables = [];
150
-        foreach($xConfig->getOption($sOptionName, []) as $xKey => $xValue)
150
+        foreach ($xConfig->getOption($sOptionName, []) as $xKey => $xValue)
151 151
         {
152
-            if(is_string($xKey))
152
+            if (is_string($xKey))
153 153
             {
154 154
                 $aCallables[$xKey] = $xValue;
155 155
                 continue;
156 156
             }
157
-            if(is_string($xValue))
157
+            if (is_string($xValue))
158 158
             {
159 159
                 $aCallables[] = $xValue;
160 160
                 continue;
161 161
             }
162 162
 
163
-            if(is_array($xValue) && isset($xValue[$sOptionKey]))
163
+            if (is_array($xValue) && isset($xValue[$sOptionKey]))
164 164
             {
165 165
                 $aCallables[$xValue[$sOptionKey]] = $xValue;
166 166
             }
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
     {
216 216
         // $this->aPackages contains packages config file paths.
217 217
         $aLibOptions = $sClassName::config();
218
-        if(is_string($aLibOptions))
218
+        if (is_string($aLibOptions))
219 219
         {
220 220
             // A string is supposed to be the path to a config file.
221 221
             $aLibOptions = $this->xConfigManager->read($aLibOptions);
222 222
         }
223
-        elseif(!is_array($aLibOptions))
223
+        elseif (!is_array($aLibOptions))
224 224
         {
225 225
             // Otherwise, anything else than an array is not accepted.
226 226
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     public function registerPackage(string $sClassName, array $aUserOptions = []): void
244 244
     {
245 245
         $sClassName = trim($sClassName, '\\ ');
246
-        if(!is_subclass_of($sClassName, AbstractPackage::class))
246
+        if (!is_subclass_of($sClassName, AbstractPackage::class))
247 247
         {
248 248
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
249 249
             throw new SetupException($sMessage);
@@ -287,9 +287,9 @@  discard block
 block discarded – undo
287 287
 
288 288
         // Register packages
289 289
         $aPackageConfig = $xAppConfig->getOption('packages', []);
290
-        foreach($aPackageConfig as $xKey => $xValue)
290
+        foreach ($aPackageConfig as $xKey => $xValue)
291 291
         {
292
-            if(is_integer($xKey) && is_string($xValue))
292
+            if (is_integer($xKey) && is_string($xValue))
293 293
             {
294 294
                 // Register a package without options
295 295
                 $sClassName = $xValue;
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                 continue;
298 298
             }
299 299
 
300
-            if(is_string($xKey) && is_array($xValue))
300
+            if (is_string($xKey) && is_array($xValue))
301 301
             {
302 302
                 // Register a package with options
303 303
                 $sClassName = $xKey;
Please login to merge, or discard this patch.