Passed
Push — main ( 87fed9...27211a )
by Thierry
04:04
created
jaxon-core/src/App/Config/ConfigEventManager.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -19,61 +19,61 @@
 block discarded – undo
19 19
 
20 20
 class ConfigEventManager
21 21
 {
22
-    /**
22
+/**
23 23
      * @var string[]
24 24
      */
25
-    protected $aLibConfigListeners = [];
25
+protected $aLibConfigListeners = [];
26 26
 
27
-    /**
27
+/**
28 28
      * @var string[]
29 29
      */
30
-    protected $aAppConfigListeners = [];
30
+protected $aAppConfigListeners = [];
31 31
 
32
-    /**
32
+/**
33 33
      * @param Container $di
34 34
      */
35
-    public function __construct(private Container $di)
36
-    {}
35
+public function __construct(private Container $di)
36
+{}
37 37
 
38
-    /**
38
+/**
39 39
      * @param string $sClassName
40 40
      *
41 41
      * @return void
42 42
      */
43
-    public function addLibConfigListener(string $sClassName): void
44
-    {
45
-        $this->aLibConfigListeners[] = $sClassName;
46
-    }
43
+public function addLibConfigListener(string $sClassName): void
44
+{
45
+$this->aLibConfigListeners[] = $sClassName;
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * @param string $sClassName
50 50
      *
51 51
      * @return void
52 52
      */
53
-    public function addAppConfigListener(string $sClassName): void
54
-    {
55
-        $this->aAppConfigListeners[] = $sClassName;
56
-    }
53
+public function addAppConfigListener(string $sClassName): void
54
+{
55
+$this->aAppConfigListeners[] = $sClassName;
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * @inheritDoc
60 60
      */
61
-    public function libConfigChanged(Config $xConfig, string $sName): void
62
-    {
63
-        foreach($this->aLibConfigListeners as $sListener)
64
-        {
65
-            $this->di->g($sListener)->onChange($xConfig, $sName);
66
-        }
67
-    }
61
+public function libConfigChanged(Config $xConfig, string $sName): void
62
+{
63
+foreach($this->aLibConfigListeners as $sListener)
64
+{
65
+$this->di->g($sListener)->onChange($xConfig, $sName);
66
+}
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * @inheritDoc
71 71
      */
72
-    public function appConfigChanged(Config $xConfig, string $sName): void
73
-    {
74
-        foreach($this->aAppConfigListeners as $sListener)
75
-        {
76
-            $this->di->g($sListener)->onChange($xConfig, $sName);
77
-        }
78
-    }
72
+public function appConfigChanged(Config $xConfig, string $sName): void
73
+{
74
+foreach($this->aAppConfigListeners as $sListener)
75
+{
76
+$this->di->g($sListener)->onChange($xConfig, $sName);
77
+}
78
+}
79 79
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Config/ConfigListenerInterface.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
 interface ConfigListenerInterface
20 20
 {
21
-    /**
21
+/**
22 22
      * Config option changed, in case of multiple changes, the name is an empty string
23 23
      *
24 24
      * @param Config $xConfig
@@ -26,5 +26,5 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @return void
28 28
      */
29
-    public function onChange(Config $xConfig, string $sName): void;
29
+public function onChange(Config $xConfig, string $sName): void;
30 30
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Config/ConfigManager.php 1 patch
Switch Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
 
30 30
 class ConfigManager
31 31
 {
32
-    /**
32
+/**
33 33
      * @var Config
34 34
      */
35
-    protected $xLibConfig;
35
+protected $xLibConfig;
36 36
 
37
-    /**
37
+/**
38 38
      * @var Config
39 39
      */
40
-    protected $xAppConfig;
40
+protected $xAppConfig;
41 41
 
42
-    /**
42
+/**
43 43
      * The constructor
44 44
      *
45 45
      * @param array $aDefaultOptions
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
      * @param ConfigSetter $xConfigSetter
49 49
      * @param ConfigEventManager $xEventManager
50 50
      */
51
-    public function __construct(array $aDefaultOptions, private Translator $xTranslator,
52
-        private ConfigReader $xConfigReader, private ConfigSetter $xConfigSetter,
53
-        private ConfigEventManager $xEventManager)
54
-    {
55
-        $this->xLibConfig = $xConfigSetter->newConfig($aDefaultOptions);
56
-        $this->xAppConfig = $xConfigSetter->newConfig();
57
-    }
51
+public function __construct(array $aDefaultOptions, private Translator $xTranslator,
52
+private ConfigReader $xConfigReader, private ConfigSetter $xConfigSetter,
53
+private ConfigEventManager $xEventManager)
54
+{
55
+$this->xLibConfig = $xConfigSetter->newConfig($aDefaultOptions);
56
+$this->xAppConfig = $xConfigSetter->newConfig();
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * Read a config file
61 61
      *
62 62
      * @param string $sConfigFile
@@ -64,35 +64,35 @@  discard block
 block discarded – undo
64 64
      * @return array
65 65
      * @throws SetupException
66 66
      */
67
-    public function read(string $sConfigFile): array
68
-    {
69
-        try
70
-        {
71
-            return $this->xConfigReader->read($sConfigFile);
72
-        }
73
-        catch(YamlExtension $e)
74
-        {
75
-            $sMessage = $this->xTranslator->trans('errors.yaml.install');
76
-            throw new SetupException($sMessage);
77
-        }
78
-        catch(FileExtension $e)
79
-        {
80
-            $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]);
81
-            throw new SetupException($sMessage);
82
-        }
83
-        catch(FileAccess $e)
84
-        {
85
-            $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]);
86
-            throw new SetupException($sMessage);
87
-        }
88
-        catch(FileContent $e)
89
-        {
90
-            $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]);
91
-            throw new SetupException($sMessage);
92
-        }
93
-    }
67
+public function read(string $sConfigFile): array
68
+{
69
+try
70
+{
71
+return $this->xConfigReader->read($sConfigFile);
72
+}
73
+catch(YamlExtension $e)
74
+{
75
+$sMessage = $this->xTranslator->trans('errors.yaml.install');
76
+throw new SetupException($sMessage);
77
+}
78
+catch(FileExtension $e)
79
+{
80
+$sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]);
81
+throw new SetupException($sMessage);
82
+}
83
+catch(FileAccess $e)
84
+{
85
+$sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]);
86
+throw new SetupException($sMessage);
87
+}
88
+catch(FileContent $e)
89
+{
90
+$sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]);
91
+throw new SetupException($sMessage);
92
+}
93
+}
94 94
 
95
-    /**
95
+/**
96 96
      * Read options from a config file and set the library config
97 97
      *
98 98
      * @param string $sConfigFile The full path to the config file
@@ -101,27 +101,27 @@  discard block
 block discarded – undo
101 101
      * @return void
102 102
      * @throws SetupException
103 103
      */
104
-    public function load(string $sConfigFile, string $sConfigSection = ''): void
105
-    {
106
-        try
107
-        {
108
-            // Read the options and save in the config.
109
-            $this->xLibConfig = $this->xConfigSetter
110
-                ->setOptions($this->xLibConfig, $this->read($sConfigFile), $sConfigSection);
111
-            // Call the config change listeners.
112
-            $this->xEventManager->libConfigChanged($this->xLibConfig, '');
113
-        }
114
-        catch(DataDepth $e)
115
-        {
116
-            $sMessage = $this->xTranslator->trans('errors.data.depth', [
117
-                'key' => $e->sPrefix,
118
-                'depth' => $e->nDepth,
119
-            ]);
120
-            throw new SetupException($sMessage);
121
-        }
122
-    }
104
+public function load(string $sConfigFile, string $sConfigSection = ''): void
105
+{
106
+try
107
+{
108
+// Read the options and save in the config.
109
+$this->xLibConfig = $this->xConfigSetter
110
+    ->setOptions($this->xLibConfig, $this->read($sConfigFile), $sConfigSection);
111
+// Call the config change listeners.
112
+$this->xEventManager->libConfigChanged($this->xLibConfig, '');
113
+}
114
+catch(DataDepth $e)
115
+{
116
+$sMessage = $this->xTranslator->trans('errors.data.depth', [
117
+    'key' => $e->sPrefix,
118
+    'depth' => $e->nDepth,
119
+]);
120
+throw new SetupException($sMessage);
121
+}
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * Set the config options of the library
126 126
      *
127 127
      * @param array $aOptions
@@ -130,27 +130,27 @@  discard block
 block discarded – undo
130 130
      * @return bool
131 131
      * @throws SetupException
132 132
      */
133
-    public function setOptions(array $aOptions, string $sNamePrefix = ''): bool
134
-    {
135
-        try
136
-        {
137
-            $this->xLibConfig = $this->xConfigSetter
138
-                ->setOptions($this->xLibConfig, $aOptions, $sNamePrefix);
139
-            // Call the config change listeners.
140
-            $this->xEventManager->libConfigChanged($this->xLibConfig, '');
141
-            return $this->xLibConfig->changed();
142
-        }
143
-        catch(DataDepth $e)
144
-        {
145
-            $sMessage = $this->xTranslator->trans('errors.data.depth', [
146
-                'key' => $e->sPrefix,
147
-                'depth' => $e->nDepth,
148
-            ]);
149
-            throw new SetupException($sMessage);
150
-        }
151
-    }
133
+public function setOptions(array $aOptions, string $sNamePrefix = ''): bool
134
+{
135
+try
136
+{
137
+$this->xLibConfig = $this->xConfigSetter
138
+    ->setOptions($this->xLibConfig, $aOptions, $sNamePrefix);
139
+// Call the config change listeners.
140
+$this->xEventManager->libConfigChanged($this->xLibConfig, '');
141
+return $this->xLibConfig->changed();
142
+}
143
+catch(DataDepth $e)
144
+{
145
+$sMessage = $this->xTranslator->trans('errors.data.depth', [
146
+    'key' => $e->sPrefix,
147
+    'depth' => $e->nDepth,
148
+]);
149
+throw new SetupException($sMessage);
150
+}
151
+}
152 152
 
153
-    /**
153
+/**
154 154
      * Set the value of a config option
155 155
      *
156 156
      * @param string $sName The option name
@@ -158,15 +158,15 @@  discard block
 block discarded – undo
158 158
      *
159 159
      * @return void
160 160
      */
161
-    public function setOption(string $sName, $xValue): void
162
-    {
163
-        $this->xLibConfig = $this->xConfigSetter
164
-            ->setOption($this->xLibConfig, $sName, $xValue);
165
-        // Call the config change listeners.
166
-        $this->xEventManager->libConfigChanged($this->xLibConfig, $sName);
167
-    }
161
+public function setOption(string $sName, $xValue): void
162
+{
163
+$this->xLibConfig = $this->xConfigSetter
164
+->setOption($this->xLibConfig, $sName, $xValue);
165
+// Call the config change listeners.
166
+$this->xEventManager->libConfigChanged($this->xLibConfig, $sName);
167
+}
168 168
 
169
-    /**
169
+/**
170 170
      * Get the value of a config option
171 171
      *
172 172
      * @param string $sName The option name
@@ -174,36 +174,36 @@  discard block
 block discarded – undo
174 174
      *
175 175
      * @return mixed
176 176
      */
177
-    public function getOption(string $sName, $xDefault = null): mixed
178
-    {
179
-        return $this->xLibConfig->getOption($sName, $xDefault);
180
-    }
177
+public function getOption(string $sName, $xDefault = null): mixed
178
+{
179
+return $this->xLibConfig->getOption($sName, $xDefault);
180
+}
181 181
 
182
-    /**
182
+/**
183 183
      * Check the presence of a config option
184 184
      *
185 185
      * @param string $sName The option name
186 186
      *
187 187
      * @return bool
188 188
      */
189
-    public function hasOption(string $sName): bool
190
-    {
191
-        return $this->xLibConfig->hasOption($sName);
192
-    }
189
+public function hasOption(string $sName): bool
190
+{
191
+return $this->xLibConfig->hasOption($sName);
192
+}
193 193
 
194
-    /**
194
+/**
195 195
      * Get the names of the options matching a given prefix
196 196
      *
197 197
      * @param string $sPrefix The prefix to match
198 198
      *
199 199
      * @return array
200 200
      */
201
-    public function getOptionNames(string $sPrefix): array
202
-    {
203
-        return $this->xLibConfig->getOptionNames($sPrefix);
204
-    }
201
+public function getOptionNames(string $sPrefix): array
202
+{
203
+return $this->xLibConfig->getOptionNames($sPrefix);
204
+}
205 205
 
206
-    /**
206
+/**
207 207
      * Set the value of a config option
208 208
      *
209 209
      * @param string $sName The option name
@@ -211,25 +211,25 @@  discard block
 block discarded – undo
211 211
      *
212 212
      * @return void
213 213
      */
214
-    public function setAppOption(string $sName, $xValue): void
215
-    {
216
-        $this->xAppConfig = $this->xConfigSetter
217
-            ->setOption($this->xAppConfig, $sName, $xValue);
218
-        // Call the config change listeners.
219
-        $this->xEventManager->appConfigChanged($this->xAppConfig, $sName);
220
-    }
214
+public function setAppOption(string $sName, $xValue): void
215
+{
216
+$this->xAppConfig = $this->xConfigSetter
217
+->setOption($this->xAppConfig, $sName, $xValue);
218
+// Call the config change listeners.
219
+$this->xEventManager->appConfigChanged($this->xAppConfig, $sName);
220
+}
221 221
 
222
-    /**
222
+/**
223 223
      * Get the application config
224 224
      *
225 225
      * @return Config
226 226
      */
227
-    public function getAppConfig(): Config
228
-    {
229
-        return $this->xAppConfig;
230
-    }
227
+public function getAppConfig(): Config
228
+{
229
+return $this->xAppConfig;
230
+}
231 231
 
232
-    /**
232
+/**
233 233
      * Set the application config options
234 234
      *
235 235
      * @param array $aAppOptions
@@ -237,27 +237,27 @@  discard block
 block discarded – undo
237 237
      *
238 238
      * @return bool
239 239
      */
240
-    public function setAppOptions(array $aAppOptions, string $sNamePrefix = ''): bool
241
-    {
242
-        try
243
-        {
244
-            $this->xAppConfig = $this->xConfigSetter
245
-                ->setOptions($this->xAppConfig, $aAppOptions, $sNamePrefix);
246
-            // Call the config change listeners.
247
-            $this->xEventManager->appConfigChanged($this->xAppConfig, '');
248
-            return $this->xAppConfig->changed();
249
-        }
250
-        catch(DataDepth $e)
251
-        {
252
-            $sMessage = $this->xTranslator->trans('errors.data.depth', [
253
-                'key' => $e->sPrefix,
254
-                'depth' => $e->nDepth,
255
-            ]);
256
-            throw new SetupException($sMessage);
257
-        }
258
-    }
240
+public function setAppOptions(array $aAppOptions, string $sNamePrefix = ''): bool
241
+{
242
+try
243
+{
244
+$this->xAppConfig = $this->xConfigSetter
245
+    ->setOptions($this->xAppConfig, $aAppOptions, $sNamePrefix);
246
+// Call the config change listeners.
247
+$this->xEventManager->appConfigChanged($this->xAppConfig, '');
248
+return $this->xAppConfig->changed();
249
+}
250
+catch(DataDepth $e)
251
+{
252
+$sMessage = $this->xTranslator->trans('errors.data.depth', [
253
+    'key' => $e->sPrefix,
254
+    'depth' => $e->nDepth,
255
+]);
256
+throw new SetupException($sMessage);
257
+}
258
+}
259 259
 
260
-    /**
260
+/**
261 261
      * Get the value of an application config option
262 262
      *
263 263
      * @param string $sName The option name
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
      *
266 266
      * @return mixed
267 267
      */
268
-    public function getAppOption(string $sName, $xDefault = null): mixed
269
-    {
270
-        return $this->xAppConfig->getOption($sName, $xDefault);
271
-    }
268
+public function getAppOption(string $sName, $xDefault = null): mixed
269
+{
270
+return $this->xAppConfig->getOption($sName, $xDefault);
271
+}
272 272
 
273
-    /**
273
+/**
274 274
      * Check the presence of an application config option
275 275
      *
276 276
      * @param string $sName The option name
277 277
      *
278 278
      * @return bool
279 279
      */
280
-    public function hasAppOption(string $sName): bool
281
-    {
282
-        return $this->xAppConfig->hasOption($sName);
283
-    }
280
+public function hasAppOption(string $sName): bool
281
+{
282
+return $this->xAppConfig->hasOption($sName);
283
+}
284 284
 
285
-    /**
285
+/**
286 286
      * Create a new the config object
287 287
      *
288 288
      * @param array $aOptions     The options array
@@ -291,54 +291,54 @@  discard block
 block discarded – undo
291 291
      * @return Config
292 292
      * @throws SetupException
293 293
      */
294
-    public function newConfig(array $aOptions = [], string $sNamePrefix = ''): Config
295
-    {
296
-        try
297
-        {
298
-            return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix);
299
-        }
300
-        catch(DataDepth $e)
301
-        {
302
-            $sMessage = $this->xTranslator->trans('errors.data.depth', [
303
-                'key' => $e->sPrefix,
304
-                'depth' => $e->nDepth,
305
-            ]);
306
-            throw new SetupException($sMessage);
307
-        }
308
-    }
294
+public function newConfig(array $aOptions = [], string $sNamePrefix = ''): Config
295
+{
296
+try
297
+{
298
+return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix);
299
+}
300
+catch(DataDepth $e)
301
+{
302
+$sMessage = $this->xTranslator->trans('errors.data.depth', [
303
+    'key' => $e->sPrefix,
304
+    'depth' => $e->nDepth,
305
+]);
306
+throw new SetupException($sMessage);
307
+}
308
+}
309 309
 
310
-    /**
310
+/**
311 311
      * @param string $sClassName
312 312
      *
313 313
      * @return void
314 314
      */
315
-    public function addLibEventListener(string $sClassName): void
316
-    {
317
-        $this->xEventManager->addLibConfigListener($sClassName);
318
-    }
315
+public function addLibEventListener(string $sClassName): void
316
+{
317
+$this->xEventManager->addLibConfigListener($sClassName);
318
+}
319 319
 
320
-    /**
320
+/**
321 321
      * @param string $sClassName
322 322
      *
323 323
      * @return void
324 324
      */
325
-    public function addAppEventListener(string $sClassName): void
326
-    {
327
-        $this->xEventManager->addAppConfigListener($sClassName);
328
-    }
325
+public function addAppEventListener(string $sClassName): void
326
+{
327
+$this->xEventManager->addAppConfigListener($sClassName);
328
+}
329 329
 
330
-    /**
330
+/**
331 331
      * Make the helpers functions available in the global namespace.
332 332
      *
333 333
      * @param bool $bForce
334 334
      *
335 335
      * @return void
336 336
      */
337
-    public function globals(bool $bForce = false): void
338
-    {
339
-        if($bForce || $this->getAppOption('helpers.global', true))
340
-        {
341
-            require_once dirname(__DIR__, 2) . '/globals.php';
342
-        }
343
-    }
337
+public function globals(bool $bForce = false): void
338
+{
339
+if($bForce || $this->getAppOption('helpers.global', true))
340
+{
341
+require_once dirname(__DIR__, 2) . '/globals.php';
342
+}
343
+}
344 344
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Config/ConfigTrait.php 1 patch
Switch Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 
17 17
 trait ConfigTrait
18 18
 {
19
-    /**
19
+/**
20 20
      * @return ConfigManager
21 21
      */
22
-    abstract protected function config(): ConfigManager;
22
+abstract protected function config(): ConfigManager;
23 23
 
24
-    /**
24
+/**
25 25
      * Get the value of a config option
26 26
      *
27 27
      * @param string $sName The option name
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
      *
30 30
      * @return mixed
31 31
      */
32
-    public function getLibOption(string $sName, $xDefault = null): mixed
33
-    {
34
-        return $this->config()->getOption($sName, $xDefault);
35
-    }
32
+public function getLibOption(string $sName, $xDefault = null): mixed
33
+{
34
+return $this->config()->getOption($sName, $xDefault);
35
+}
36 36
 
37
-    /**
37
+/**
38 38
      * Check the presence of a config option
39 39
      *
40 40
      * @param string $sName The option name
41 41
      *
42 42
      * @return bool
43 43
      */
44
-    public function hasLibOption(string $sName): bool
45
-    {
46
-        return $this->config()->hasOption($sName);
47
-    }
44
+public function hasLibOption(string $sName): bool
45
+{
46
+return $this->config()->hasOption($sName);
47
+}
48 48
 
49
-    /**
49
+/**
50 50
      * Set the value of a config option
51 51
      *
52 52
      * @param string $sName The option name
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return void
56 56
      */
57
-    public function setLibOption(string $sName, $xValue): void
58
-    {
59
-        $this->config()->setOption($sName, $xValue);
60
-    }
57
+public function setLibOption(string $sName, $xValue): void
58
+{
59
+$this->config()->setOption($sName, $xValue);
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * Get the value of an application config option
64 64
      *
65 65
      * @param string $sName The option name
@@ -67,24 +67,24 @@  discard block
 block discarded – undo
67 67
      *
68 68
      * @return mixed
69 69
      */
70
-    public function getAppOption(string $sName, $xDefault = null): mixed
71
-    {
72
-        return $this->config()->getAppOption($sName, $xDefault);
73
-    }
70
+public function getAppOption(string $sName, $xDefault = null): mixed
71
+{
72
+return $this->config()->getAppOption($sName, $xDefault);
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * Check the presence of an application config option
77 77
      *
78 78
      * @param string $sName The option name
79 79
      *
80 80
      * @return bool
81 81
      */
82
-    public function hasAppOption(string $sName): bool
83
-    {
84
-        return $this->config()->hasAppOption($sName);
85
-    }
82
+public function hasAppOption(string $sName): bool
83
+{
84
+return $this->config()->hasAppOption($sName);
85
+}
86 86
 
87
-    /**
87
+/**
88 88
      * Set the value of a config option
89 89
      *
90 90
      * @param string $sName The option name
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
      *
93 93
      * @return void
94 94
      */
95
-    public function setAppOption(string $sName, $xValue): void
96
-    {
97
-        $this->config()->setAppOption($sName, $xValue);
98
-    }
95
+public function setAppOption(string $sName, $xValue): void
96
+{
97
+$this->config()->setAppOption($sName, $xValue);
98
+}
99 99
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Metadata.php 1 patch
Switch Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -21,186 +21,186 @@
 block discarded – undo
21 21
 
22 22
 class Metadata
23 23
 {
24
-    /**
24
+/**
25 25
      * @var array<string, array<string, Data\AbstractData>>
26 26
      */
27
-    private array $aAttributes = [
28
-        'exclude' => [],
29
-        'export' => [],
30
-        'container' => [],
31
-        'databag' => [],
32
-        'callback' => [],
33
-        'before' => [],
34
-        'after' => [],
35
-        'upload' => [],
36
-    ];
37
-
38
-    /**
27
+private array $aAttributes = [
28
+'exclude' => [],
29
+'export' => [],
30
+'container' => [],
31
+'databag' => [],
32
+'callback' => [],
33
+'before' => [],
34
+'after' => [],
35
+'upload' => [],
36
+];
37
+
38
+/**
39 39
      * @return array<string, array<string, Data\AbstractData>>
40 40
      */
41
-    public function getAttributes(): array
42
-    {
43
-        return $this->aAttributes;
44
-    }
41
+public function getAttributes(): array
42
+{
43
+return $this->aAttributes;
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * @param string $sMethod
48 48
      *
49 49
      * @return Data\ExcludeData
50 50
      */
51
-    public function exclude(string $sMethod = '*'): Data\ExcludeData
52
-    {
53
-        return $this->aAttributes['exclude'][$sMethod] ??
54
-            $this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
55
-    }
51
+public function exclude(string $sMethod = '*'): Data\ExcludeData
52
+{
53
+return $this->aAttributes['exclude'][$sMethod] ??
54
+$this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
55
+}
56 56
 
57
-    /**
57
+/**
58 58
      * @param string $sMethod
59 59
      *
60 60
      * @return Data\ExportData
61 61
      */
62
-    public function export(string $sMethod = '*'): Data\ExportData
63
-    {
64
-        $sMethod = '*'; // On classes only
65
-        return $this->aAttributes['export'][$sMethod] ??
66
-            $this->aAttributes['export'][$sMethod] = new Data\ExportData();
67
-    }
62
+public function export(string $sMethod = '*'): Data\ExportData
63
+{
64
+$sMethod = '*'; // On classes only
65
+return $this->aAttributes['export'][$sMethod] ??
66
+$this->aAttributes['export'][$sMethod] = new Data\ExportData();
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * @param string $sMethod
71 71
      *
72 72
      * @return Data\ContainerData
73 73
      */
74
-    public function container(string $sMethod = '*'): Data\ContainerData
75
-    {
76
-        return $this->aAttributes['container'][$sMethod] ??
77
-            $this->aAttributes['container'][$sMethod] = new Data\ContainerData();
78
-    }
74
+public function container(string $sMethod = '*'): Data\ContainerData
75
+{
76
+return $this->aAttributes['container'][$sMethod] ??
77
+$this->aAttributes['container'][$sMethod] = new Data\ContainerData();
78
+}
79 79
 
80
-    /**
80
+/**
81 81
      * @param string $sMethod
82 82
      *
83 83
      * @return Data\DatabagData
84 84
      */
85
-    public function databag(string $sMethod = '*'): Data\DatabagData
86
-    {
87
-        return $this->aAttributes['databag'][$sMethod] ??
88
-            $this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
89
-    }
85
+public function databag(string $sMethod = '*'): Data\DatabagData
86
+{
87
+return $this->aAttributes['databag'][$sMethod] ??
88
+$this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
89
+}
90 90
 
91
-    /**
91
+/**
92 92
      * @param string $sMethod
93 93
      *
94 94
      * @return Data\CallbackData
95 95
      */
96
-    public function callback(string $sMethod = '*'): Data\CallbackData
97
-    {
98
-        return $this->aAttributes['callback'][$sMethod] ??
99
-            $this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
100
-    }
96
+public function callback(string $sMethod = '*'): Data\CallbackData
97
+{
98
+return $this->aAttributes['callback'][$sMethod] ??
99
+$this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
100
+}
101 101
 
102
-    /**
102
+/**
103 103
      * @param string $sMethod
104 104
      *
105 105
      * @return Data\BeforeData
106 106
      */
107
-    public function before(string $sMethod = '*'): Data\BeforeData
108
-    {
109
-        return $this->aAttributes['before'][$sMethod] ??
110
-            $this->aAttributes['before'][$sMethod] = new Data\BeforeData();
111
-    }
107
+public function before(string $sMethod = '*'): Data\BeforeData
108
+{
109
+return $this->aAttributes['before'][$sMethod] ??
110
+$this->aAttributes['before'][$sMethod] = new Data\BeforeData();
111
+}
112 112
 
113
-    /**
113
+/**
114 114
      * @param string $sMethod
115 115
      *
116 116
      * @return Data\AfterData
117 117
      */
118
-    public function after(string $sMethod = '*'): Data\AfterData
119
-    {
120
-        return $this->aAttributes['after'][$sMethod] ??
121
-            $this->aAttributes['after'][$sMethod] = new Data\AfterData();
122
-    }
118
+public function after(string $sMethod = '*'): Data\AfterData
119
+{
120
+return $this->aAttributes['after'][$sMethod] ??
121
+$this->aAttributes['after'][$sMethod] = new Data\AfterData();
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * @param string $sMethod
126 126
      *
127 127
      * @return Data\UploadData
128 128
      */
129
-    public function upload(string $sMethod = '*'): Data\UploadData
130
-    {
131
-        return $this->aAttributes['upload'][$sMethod] ??
132
-            $this->aAttributes['upload'][$sMethod] = new Data\UploadData();
133
-    }
129
+public function upload(string $sMethod = '*'): Data\UploadData
130
+{
131
+return $this->aAttributes['upload'][$sMethod] ??
132
+$this->aAttributes['upload'][$sMethod] = new Data\UploadData();
133
+}
134 134
 
135
-    /**
135
+/**
136 136
      * True if the class is excluded
137 137
      *
138 138
      * @return bool
139 139
      */
140
-    public function isExcluded(): bool
141
-    {
142
-        $xData = $this->aAttributes['exclude']['*'] ?? null;
143
-        return $xData !== null && $xData->getValue() === true;
144
-    }
140
+public function isExcluded(): bool
141
+{
142
+$xData = $this->aAttributes['exclude']['*'] ?? null;
143
+return $xData !== null && $xData->getValue() === true;
144
+}
145 145
 
146
-    /**
146
+/**
147 147
      * Get the properties of the class methods
148 148
      *
149 149
      * @return array
150 150
      */
151
-    public function getProperties(): array
151
+public function getProperties(): array
152
+{
153
+$aProperties = [];
154
+$aClassProperties = [];
155
+foreach($this->aAttributes as $sType => $aValues)
156
+{
157
+if($sType === 'exclude')
158
+{
159
+    continue;
160
+}
161
+
162
+foreach($aValues as $sMethod => $xData)
163
+{
164
+    if($sMethod === '*')
152 165
     {
153
-        $aProperties = [];
154
-        $aClassProperties = [];
155
-        foreach($this->aAttributes as $sType => $aValues)
156
-        {
157
-            if($sType === 'exclude')
158
-            {
159
-                continue;
160
-            }
161
-
162
-            foreach($aValues as $sMethod => $xData)
163
-            {
164
-                if($sMethod === '*')
165
-                {
166
-                    $aClassProperties[$xData->getName()] = $xData->getValue();
167
-                    continue;
168
-                }
169
-                $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
170
-            }
171
-        }
172
-
173
-        if(count($aClassProperties) > 0)
174
-        {
175
-            $aProperties['*'] = $aClassProperties;
176
-        }
177
-
178
-        return $aProperties;
166
+        $aClassProperties[$xData->getName()] = $xData->getValue();
167
+        continue;
179 168
     }
169
+    $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
170
+}
171
+}
172
+
173
+if(count($aClassProperties) > 0)
174
+{
175
+$aProperties['*'] = $aClassProperties;
176
+}
180 177
 
181
-    /**
178
+return $aProperties;
179
+}
180
+
181
+/**
182 182
      * Get the methods in the export attributes
183 183
      *
184 184
      * @return array
185 185
      */
186
-    public function getExportMethods(): array
187
-    {
188
-        /** @var Data\ExportData */
189
-        $xExportData = $this->aAttributes['export']['*'] ?? null;
190
-        return $xExportData?->getMethods() ?? [];
191
-    }
186
+public function getExportMethods(): array
187
+{
188
+/** @var Data\ExportData */
189
+$xExportData = $this->aAttributes['export']['*'] ?? null;
190
+return $xExportData?->getMethods() ?? [];
191
+}
192 192
 
193
-    /**
193
+/**
194 194
      * Get the protected methods
195 195
      *
196 196
      * @return array
197 197
      */
198
-    public function getProtectedMethods(): array
199
-    {
200
-        /** @var array<Data\ExcludeData> */
201
-        $aAttributes = $this->aAttributes['exclude'];
202
-        $aMethods = array_keys($aAttributes);
203
-        return array_values(array_filter($aMethods, fn(string $sName) =>
204
-            $sName !== '*' && $aAttributes[$sName]->getValue() === true));
205
-    }
198
+public function getProtectedMethods(): array
199
+{
200
+/** @var array<Data\ExcludeData> */
201
+$aAttributes = $this->aAttributes['exclude'];
202
+$aMethods = array_keys($aAttributes);
203
+return array_values(array_filter($aMethods, fn(string $sName) =>
204
+$sName !== '*' && $aAttributes[$sName]->getValue() === true));
205
+}
206 206
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/HookData.php 1 patch
Switch Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,59 +21,59 @@
 block discarded – undo
21 21
 
22 22
 abstract class HookData extends AbstractData
23 23
 {
24
-    /**
24
+/**
25 25
      * @var array
26 26
      */
27
-    protected $aCalls = [];
27
+protected $aCalls = [];
28 28
 
29
-    /**
29
+/**
30 30
      * @return string
31 31
      */
32
-    abstract protected function getType(): string;
32
+abstract protected function getType(): string;
33 33
 
34
-    /**
34
+/**
35 35
      * @return string
36 36
      */
37
-    public function getName(): string
38
-    {
39
-        return '__' . $this->getType();
40
-    }
37
+public function getName(): string
38
+{
39
+return '__' . $this->getType();
40
+}
41 41
 
42
-    /**
42
+/**
43 43
      * @return mixed
44 44
      */
45
-    public function getValue(): mixed
46
-    {
47
-        return $this->aCalls;
48
-    }
45
+public function getValue(): mixed
46
+{
47
+return $this->aCalls;
48
+}
49 49
 
50
-    /**
50
+/**
51 51
      * @param string $sMethod
52 52
      * @param array $aParams
53 53
      *
54 54
      * @return void
55 55
      */
56
-    public function addCall(string $sMethod, array $aParams): void
57
-    {
58
-        if(!$this->validateMethod($sMethod))
59
-        {
60
-            $sType = $this->getType();
61
-            throw new SetupException("'$sMethod' is not a valid \"call\" value for $sType.");
62
-        }
63
-        $this->aCalls[$sMethod] = $aParams;
64
-    }
56
+public function addCall(string $sMethod, array $aParams): void
57
+{
58
+if(!$this->validateMethod($sMethod))
59
+{
60
+$sType = $this->getType();
61
+throw new SetupException("'$sMethod' is not a valid \"call\" value for $sType.");
62
+}
63
+$this->aCalls[$sMethod] = $aParams;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * @inheritDoc
68 68
      */
69
-    public function encode(string $sVarName): array
70
-    {
71
-        $aCalls = [];
72
-        foreach($this->aCalls as $sMethod => $aParams)
73
-        {
74
-            $sParams = addslashes(json_encode($aParams));
75
-            $aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));";
76
-        }
77
-        return $aCalls;
78
-    }
69
+public function encode(string $sVarName): array
70
+{
71
+$aCalls = [];
72
+foreach($this->aCalls as $sMethod => $aParams)
73
+{
74
+$sParams = addslashes(json_encode($aParams));
75
+$aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));";
76
+}
77
+return $aCalls;
78
+}
79 79
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/AbstractData.php 1 patch
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,22 +18,22 @@
 block discarded – undo
18 18
 
19 19
 abstract class AbstractData
20 20
 {
21
-    /**
21
+/**
22 22
      * Generate the PHP code to populate a Metadata object
23 23
      *
24 24
      * @param string $sVarName
25 25
      *
26 26
      * @return array
27 27
      */
28
-    abstract public function encode(string $sVarName): array;
28
+abstract public function encode(string $sVarName): array;
29 29
 
30
-    /**
30
+/**
31 31
      * @param string $sMethod
32 32
      *
33 33
      * @return bool
34 34
      */
35
-    protected function validateMethod(string $sMethod): bool
36
-    {
37
-        return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0;
38
-    }
35
+protected function validateMethod(string $sMethod): bool
36
+{
37
+return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0;
38
+}
39 39
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/ExportData.php 1 patch
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,53 +22,53 @@
 block discarded – undo
22 22
 
23 23
 class ExportData extends AbstractData
24 24
 {
25
-    /**
25
+/**
26 26
      * @var array
27 27
      */
28
-    private array $aMethods = [];
28
+private array $aMethods = [];
29 29
 
30
-    /**
30
+/**
31 31
      * @return string
32 32
      */
33
-    public function getName(): string
34
-    {
35
-        return 'export';
36
-    }
33
+public function getName(): string
34
+{
35
+return 'export';
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * @return mixed
40 40
      */
41
-    public function getMethods(): mixed
42
-    {
43
-        return $this->aMethods;
44
-    }
41
+public function getMethods(): mixed
42
+{
43
+return $this->aMethods;
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * @param array $aMethods
48 48
      *
49 49
      * @return void
50 50
      */
51
-    public function setMethods(array $aMethods): void
51
+public function setMethods(array $aMethods): void
52
+{
53
+foreach(['base', 'only', 'except'] as $sKey)
54
+{
55
+foreach($aMethods[$sKey] as $sMethod)
56
+{
57
+    if(!is_string($sMethod) || !$this->validateMethod($sMethod))
52 58
     {
53
-        foreach(['base', 'only', 'except'] as $sKey)
54
-        {
55
-            foreach($aMethods[$sKey] as $sMethod)
56
-            {
57
-                if(!is_string($sMethod) || !$this->validateMethod($sMethod))
58
-                {
59
-                    throw new SetupException("'$sMethod' is not a valid method name.");
60
-                }
61
-            }
62
-        }
63
-        $this->aMethods = $aMethods;
59
+        throw new SetupException("'$sMethod' is not a valid method name.");
64 60
     }
61
+}
62
+}
63
+$this->aMethods = $aMethods;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * @inheritDoc
68 68
      */
69
-    public function encode(string $sVarName): array
70
-    {
71
-        $sMethods = addslashes(json_encode($this->aMethods));
72
-        return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
-    }
69
+public function encode(string $sVarName): array
70
+{
71
+$sMethods = addslashes(json_encode($this->aMethods));
72
+return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
+}
74 74
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/FuncComponent.php 1 patch
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@  discard block
 block discarded – undo
8 8
 
9 9
 class FuncComponent extends Component\AbstractComponent
10 10
 {
11
-    use Component\HelperTrait;
12
-    use Component\AjaxResponseTrait;
13
-    use Component\ComponentTrait;
11
+use Component\HelperTrait;
12
+use Component\AjaxResponseTrait;
13
+use Component\ComponentTrait;
14 14
 
15
-    /**
15
+/**
16 16
      * @inheritDoc
17 17
      */
18
-    final protected function initComponent(Container $di, ComponentHelper $xHelper): void
19
-    {
20
-        $this->setHelper($xHelper);
21
-        $this->setAjaxResponse($di);
22
-    }
18
+final protected function initComponent(Container $di, ComponentHelper $xHelper): void
19
+{
20
+$this->setHelper($xHelper);
21
+$this->setAjaxResponse($di);
22
+}
23 23
 
24
-    /**
24
+/**
25 25
      * Create a paginator.
26 26
      *
27 27
      * @param int $nPageNumber     The current page number
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @return Paginator
32 32
      */
33
-    final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator
34
-    {
35
-        return $this->response->paginator($nPageNumber, $nItemsPerPage, $nTotalItems);
36
-    }
33
+final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator
34
+{
35
+return $this->response->paginator($nPageNumber, $nItemsPerPage, $nTotalItems);
36
+}
37 37
 }
Please login to merge, or discard this patch.