Passed
Push — main ( 8fa9e1...957ef0 )
by Thierry
06:37
created
jaxon-attributes/src/AttributeReader.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -258,8 +258,7 @@
 block discarded – undo
258 258
             }
259 259
 
260 260
             return $this->xMetadata;
261
-        }
262
-        catch(Exception|Error $e)
261
+        } catch(Exception|Error $e)
263 262
         {
264 263
             throw new SetupException($e->getMessage());
265 264
         }
Please login to merge, or discard this patch.
jaxon-core/src/Response/Manager/ResponseManager.php 1 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/Plugin/Manager/PackageManager.php 1 patch
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.
jaxon-core/src/Plugin/Request/CallableFunction/CallableFunctionPlugin.php 2 patches
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -92,8 +92,7 @@  discard block
 block discarded – undo
92 92
         if(is_string($xOptions))
93 93
         {
94 94
             $xOptions = ['include' => $xOptions];
95
-        }
96
-        elseif(!is_array($xOptions))
95
+        } elseif(!is_array($xOptions))
97 96
         {
98 97
             throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
99 98
         }
@@ -236,8 +235,7 @@  discard block
 block discarded – undo
236 235
         {
237 236
             /** @var CallableFunction */
238 237
             $xFunction = $this->getCallable($sRequestedFunction);
239
-        }
240
-        catch(Exception $e)
238
+        } catch(Exception $e)
241 239
         {
242 240
             // Unable to find the requested function
243 241
             $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid',
@@ -246,8 +244,7 @@  discard block
 block discarded – undo
246 244
         try
247 245
         {
248 246
             $xFunction->call($this->xTarget->args());
249
-        }
250
-        catch(Exception $e)
247
+        } catch(Exception $e)
251 248
         {
252 249
             // Unable to execute the requested function
253 250
             $this->throwException($e, $this->xTranslator->trans('errors.functions.call',
Please login to merge, or discard this patch.
Switch Indentation   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 
44 44
 class CallableFunctionPlugin extends AbstractRequestPlugin
45 45
 {
46
-    /**
46
+/**
47 47
      * The registered functions names
48 48
      *
49 49
      * @var array
50 50
      */
51
-    protected $aFunctions = [];
51
+protected $aFunctions = [];
52 52
 
53
-    /**
53
+/**
54 54
      * The registered functions options
55 55
      *
56 56
      * @var array
57 57
      */
58
-    protected $aOptions = [];
58
+protected $aOptions = [];
59 59
 
60
-    /**
60
+/**
61 61
      * The constructor
62 62
      *
63 63
      * @param string $sPrefix
@@ -67,41 +67,41 @@  discard block
 block discarded – undo
67 67
      * @param Translator $xTranslator
68 68
      * @param Validator $xValidator
69 69
      */
70
-    public function __construct(private string $sPrefix, private bool $bDebug,
71
-        private Container $di, private TemplateEngine $xTemplateEngine,
72
-        private Translator $xTranslator, private Validator $xValidator)
73
-    {}
70
+public function __construct(private string $sPrefix, private bool $bDebug,
71
+private Container $di, private TemplateEngine $xTemplateEngine,
72
+private Translator $xTranslator, private Validator $xValidator)
73
+{}
74 74
 
75
-    /**
75
+/**
76 76
      * @inheritDoc
77 77
      */
78
-    public function getName(): string
79
-    {
80
-        return Jaxon::CALLABLE_FUNCTION;
81
-    }
78
+public function getName(): string
79
+{
80
+return Jaxon::CALLABLE_FUNCTION;
81
+}
82 82
 
83
-    /**
83
+/**
84 84
      * @inheritDoc
85 85
      * @throws SetupException
86 86
      */
87
-    public function checkOptions(string $sCallable, $xOptions): array
88
-    {
89
-        if(!$this->xValidator->validateFunction(trim($sCallable)))
90
-        {
91
-            throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
92
-        }
93
-        if(is_string($xOptions))
94
-        {
95
-            $xOptions = ['include' => $xOptions];
96
-        }
97
-        elseif(!is_array($xOptions))
98
-        {
99
-            throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
100
-        }
101
-        return $xOptions;
102
-    }
87
+public function checkOptions(string $sCallable, $xOptions): array
88
+{
89
+if(!$this->xValidator->validateFunction(trim($sCallable)))
90
+{
91
+throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
92
+}
93
+if(is_string($xOptions))
94
+{
95
+$xOptions = ['include' => $xOptions];
96
+}
97
+elseif(!is_array($xOptions))
98
+{
99
+throw new SetupException($this->xTranslator->trans('errors.objects.invalid-declaration'));
100
+}
101
+return $xOptions;
102
+}
103 103
 
104
-    /**
104
+/**
105 105
      * Register a user defined function
106 106
      *
107 107
      * @param string $sType    The type of request handler being registered
@@ -110,156 +110,156 @@  discard block
 block discarded – undo
110 110
      *
111 111
      * @return bool
112 112
      */
113
-    public function register(string $sType, string $sCallable, array $aOptions): bool
114
-    {
115
-        $sPhpFunction = trim($sCallable);
116
-        $sFunction = $sPhpFunction;
117
-        // Check if an alias is defined
118
-        if(isset($aOptions['alias']))
119
-        {
120
-            $sFunction = (string)$aOptions['alias'];
121
-            unset($aOptions['alias']);
122
-        }
123
-        $this->aFunctions[$sFunction] = $sPhpFunction;
124
-        $this->aOptions[$sFunction] = $aOptions;
125
-        return true;
126
-    }
113
+public function register(string $sType, string $sCallable, array $aOptions): bool
114
+{
115
+$sPhpFunction = trim($sCallable);
116
+$sFunction = $sPhpFunction;
117
+// Check if an alias is defined
118
+if(isset($aOptions['alias']))
119
+{
120
+$sFunction = (string)$aOptions['alias'];
121
+unset($aOptions['alias']);
122
+}
123
+$this->aFunctions[$sFunction] = $sPhpFunction;
124
+$this->aOptions[$sFunction] = $aOptions;
125
+return true;
126
+}
127 127
 
128
-    /**
128
+/**
129 129
      * @inheritDoc
130 130
      */
131
-    public function getHash(): string
132
-    {
133
-        return md5(implode('', array_keys($this->aFunctions)));
134
-    }
131
+public function getHash(): string
132
+{
133
+return md5(implode('', array_keys($this->aFunctions)));
134
+}
135 135
 
136
-    /**
136
+/**
137 137
      * @inheritDoc
138 138
      */
139
-    public function getCallable(string $sCallable): CallableFunction|null
140
-    {
141
-        $sFunction = trim($sCallable);
142
-        if(!isset($this->aFunctions[$sFunction]))
143
-        {
144
-            return null;
145
-        }
146
-        $xCallable = new CallableFunction($this->di, $sFunction,
147
-            $this->sPrefix . $sFunction, $this->aFunctions[$sFunction]);
148
-        foreach($this->aOptions[$sFunction] as $sName => $sValue)
149
-        {
150
-            $xCallable->configure($sName, $sValue);
151
-        }
152
-        return $xCallable;
153
-    }
139
+public function getCallable(string $sCallable): CallableFunction|null
140
+{
141
+$sFunction = trim($sCallable);
142
+if(!isset($this->aFunctions[$sFunction]))
143
+{
144
+return null;
145
+}
146
+$xCallable = new CallableFunction($this->di, $sFunction,
147
+$this->sPrefix . $sFunction, $this->aFunctions[$sFunction]);
148
+foreach($this->aOptions[$sFunction] as $sName => $sValue)
149
+{
150
+$xCallable->configure($sName, $sValue);
151
+}
152
+return $xCallable;
153
+}
154 154
 
155
-    /**
155
+/**
156 156
      * Generate the javascript function stub that is sent to the browser on initial page load
157 157
      *
158 158
      * @param CallableFunction $xFunction
159 159
      *
160 160
      * @return string
161 161
      */
162
-    private function getCallableScript(CallableFunction $xFunction): string
163
-    {
164
-        $aOptions = [];
165
-        foreach($xFunction->getOptions() as $sKey => $sValue)
166
-        {
167
-            $aOptions[] = "$sKey: $sValue";
168
-        }
162
+private function getCallableScript(CallableFunction $xFunction): string
163
+{
164
+$aOptions = [];
165
+foreach($xFunction->getOptions() as $sKey => $sValue)
166
+{
167
+$aOptions[] = "$sKey: $sValue";
168
+}
169 169
 
170
-        return $this->xTemplateEngine->render('jaxon::callables/function.js', [
171
-            'sName' => $xFunction->getName(),
172
-            'sJsName' => $xFunction->getJsName(),
173
-            'sArguments' => count($aOptions) === 0 ? 'args' :
174
-                'args, { ' . implode(',', $aOptions) . ' }',
175
-        ]);
176
-    }
170
+return $this->xTemplateEngine->render('jaxon::callables/function.js', [
171
+'sName' => $xFunction->getName(),
172
+'sJsName' => $xFunction->getJsName(),
173
+'sArguments' => count($aOptions) === 0 ? 'args' :
174
+    'args, { ' . implode(',', $aOptions) . ' }',
175
+]);
176
+}
177 177
 
178
-    /**
178
+/**
179 179
      * @inheritDoc
180 180
      */
181
-    public function getScript(): string
182
-    {
183
-        $code = '';
184
-        foreach(array_keys($this->aFunctions) as $sFunction)
185
-        {
186
-            $xFunction = $this->getCallable($sFunction);
187
-            $code .= $this->getCallableScript($xFunction);
188
-        }
189
-        return $code;
190
-    }
181
+public function getScript(): string
182
+{
183
+$code = '';
184
+foreach(array_keys($this->aFunctions) as $sFunction)
185
+{
186
+$xFunction = $this->getCallable($sFunction);
187
+$code .= $this->getCallableScript($xFunction);
188
+}
189
+return $code;
190
+}
191 191
 
192
-    /**
192
+/**
193 193
      * @inheritDoc
194 194
      */
195
-    public static function canProcessRequest(ServerRequestInterface $xRequest): bool
196
-    {
197
-        $aCall = $xRequest->getAttribute('jxncall');
198
-        // throw new \Exception(json_encode(['call' => $aCall]));
199
-        return $aCall !== null && ($aCall['type'] ?? '') === 'func' && isset($aCall['name']);
200
-    }
195
+public static function canProcessRequest(ServerRequestInterface $xRequest): bool
196
+{
197
+$aCall = $xRequest->getAttribute('jxncall');
198
+// throw new \Exception(json_encode(['call' => $aCall]));
199
+return $aCall !== null && ($aCall['type'] ?? '') === 'func' && isset($aCall['name']);
200
+}
201 201
 
202
-    /**
202
+/**
203 203
      * @inheritDoc
204 204
      */
205
-    public function setTarget(ServerRequestInterface $xRequest): Target
206
-    {
207
-        $aCall = $xRequest->getAttribute('jxncall');
208
-        $this->xTarget = Target::makeFunction(trim($aCall['name']));
209
-        return $this->xTarget;
210
-    }
205
+public function setTarget(ServerRequestInterface $xRequest): Target
206
+{
207
+$aCall = $xRequest->getAttribute('jxncall');
208
+$this->xTarget = Target::makeFunction(trim($aCall['name']));
209
+return $this->xTarget;
210
+}
211 211
 
212
-    /**
212
+/**
213 213
      * @param Exception $xException
214 214
      * @param string $sErrorMessage
215 215
      *
216 216
      * @throws RequestException
217 217
      * @return never
218 218
      */
219
-    private function throwException(Exception $xException, string $sErrorMessage): void
220
-    {
221
-        $this->di->getLogger()->error($xException->getMessage());
222
-        throw new RequestException($sErrorMessage . (!$this->bDebug ? '' :
223
-            "\n" . $xException->getMessage()));
224
-    }
219
+private function throwException(Exception $xException, string $sErrorMessage): void
220
+{
221
+$this->di->getLogger()->error($xException->getMessage());
222
+throw new RequestException($sErrorMessage . (!$this->bDebug ? '' :
223
+"\n" . $xException->getMessage()));
224
+}
225 225
 
226
-    /**
226
+/**
227 227
      * @inheritDoc
228 228
      * @throws RequestException
229 229
      */
230
-    public function processRequest(): void
231
-    {
232
-        $sRequestedFunction = $this->xTarget->getFunctionName();
230
+public function processRequest(): void
231
+{
232
+$sRequestedFunction = $this->xTarget->getFunctionName();
233 233
 
234
-        // Security check: make sure the requested function was registered.
235
-        if(!$this->xValidator->validateFunction($sRequestedFunction) ||
236
-            !isset($this->aFunctions[$sRequestedFunction]))
237
-        {
238
-            // Unable to find the requested function
239
-            throw new RequestException($this->xTranslator->trans('errors.functions.invalid',
240
-                ['name' => $sRequestedFunction]));
241
-        }
234
+// Security check: make sure the requested function was registered.
235
+if(!$this->xValidator->validateFunction($sRequestedFunction) ||
236
+!isset($this->aFunctions[$sRequestedFunction]))
237
+{
238
+// Unable to find the requested function
239
+throw new RequestException($this->xTranslator->trans('errors.functions.invalid',
240
+    ['name' => $sRequestedFunction]));
241
+}
242 242
 
243
-        try
244
-        {
245
-            /** @var CallableFunction */
246
-            $xFunction = $this->getCallable($sRequestedFunction);
247
-        }
248
-        catch(Exception $e)
249
-        {
250
-            // Unable to find the requested function
251
-            $this->throwException($e, $this->xTranslator->trans('errors.functions.invalid',
252
-                ['name' => $sRequestedFunction]));
253
-        }
254
-        try
255
-        {
256
-            $xFunction->call($this->xTarget->args());
257
-        }
258
-        catch(Exception $e)
259
-        {
260
-            // Unable to execute the requested function
261
-            $this->throwException($e, $this->xTranslator->trans('errors.functions.call',
262
-                ['name' => $sRequestedFunction]));
263
-        }
264
-    }
243
+try
244
+{
245
+/** @var CallableFunction */
246
+$xFunction = $this->getCallable($sRequestedFunction);
247
+}
248
+catch(Exception $e)
249
+{
250
+// Unable to find the requested function
251
+$this->throwException($e, $this->xTranslator->trans('errors.functions.invalid',
252
+    ['name' => $sRequestedFunction]));
253
+}
254
+try
255
+{
256
+$xFunction->call($this->xTarget->args());
257
+}
258
+catch(Exception $e)
259
+{
260
+// Unable to execute the requested function
261
+$this->throwException($e, $this->xTranslator->trans('errors.functions.call',
262
+    ['name' => $sRequestedFunction]));
263
+}
264
+}
265 265
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Config/ConfigManager.php 2 patches
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -69,23 +69,19 @@  discard block
 block discarded – undo
69 69
         try
70 70
         {
71 71
             return $this->xConfigReader->read($sConfigFile);
72
-        }
73
-        catch(YamlExtension $e)
72
+        } catch(YamlExtension $e)
74 73
         {
75 74
             $sMessage = $this->xTranslator->trans('errors.yaml.install');
76 75
             throw new SetupException($sMessage);
77
-        }
78
-        catch(FileExtension $e)
76
+        } catch(FileExtension $e)
79 77
         {
80 78
             $sMessage = $this->xTranslator->trans('errors.file.extension', ['path' => $sConfigFile]);
81 79
             throw new SetupException($sMessage);
82
-        }
83
-        catch(FileAccess $e)
80
+        } catch(FileAccess $e)
84 81
         {
85 82
             $sMessage = $this->xTranslator->trans('errors.file.access', ['path' => $sConfigFile]);
86 83
             throw new SetupException($sMessage);
87
-        }
88
-        catch(FileContent $e)
84
+        } catch(FileContent $e)
89 85
         {
90 86
             $sMessage = $this->xTranslator->trans('errors.file.content', ['path' => $sConfigFile]);
91 87
             throw new SetupException($sMessage);
@@ -110,8 +106,7 @@  discard block
 block discarded – undo
110 106
                 ->setOptions($this->xLibConfig, $this->read($sConfigFile), $sConfigSection);
111 107
             // Call the config change listeners.
112 108
             $this->xEventManager->libConfigChanged($this->xLibConfig, '');
113
-        }
114
-        catch(DataDepth $e)
109
+        } catch(DataDepth $e)
115 110
         {
116 111
             $sMessage = $this->xTranslator->trans('errors.data.depth', [
117 112
                 'key' => $e->sPrefix,
@@ -139,8 +134,7 @@  discard block
 block discarded – undo
139 134
             // Call the config change listeners.
140 135
             $this->xEventManager->libConfigChanged($this->xLibConfig, '');
141 136
             return $this->xLibConfig->changed();
142
-        }
143
-        catch(DataDepth $e)
137
+        } catch(DataDepth $e)
144 138
         {
145 139
             $sMessage = $this->xTranslator->trans('errors.data.depth', [
146 140
                 'key' => $e->sPrefix,
@@ -246,8 +240,7 @@  discard block
 block discarded – undo
246 240
             // Call the config change listeners.
247 241
             $this->xEventManager->appConfigChanged($this->xAppConfig, '');
248 242
             return $this->xAppConfig->changed();
249
-        }
250
-        catch(DataDepth $e)
243
+        } catch(DataDepth $e)
251 244
         {
252 245
             $sMessage = $this->xTranslator->trans('errors.data.depth', [
253 246
                 'key' => $e->sPrefix,
@@ -296,8 +289,7 @@  discard block
 block discarded – undo
296 289
         try
297 290
         {
298 291
             return $this->xConfigSetter->newConfig($aOptions, $sNamePrefix);
299
-        }
300
-        catch(DataDepth $e)
292
+        } catch(DataDepth $e)
301 293
         {
302 294
             $sMessage = $this->xTranslator->trans('errors.data.depth', [
303 295
                 'key' => $e->sPrefix,
Please login to merge, or discard this patch.
Switch Indentation   +185 added lines, -185 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,64 +291,64 @@  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
      * Check if the remote logging is enabled
312 312
      *
313 313
      * @return bool
314 314
      */
315
-    public function loggingEnabled(): bool
316
-    {
317
-        return $this->getAppOption('options.logging.enabled', false);
318
-    }
315
+public function loggingEnabled(): bool
316
+{
317
+return $this->getAppOption('options.logging.enabled', false);
318
+}
319 319
 
320
-    /**
320
+/**
321 321
      * @param string $sClassName
322 322
      *
323 323
      * @return void
324 324
      */
325
-    public function addLibEventListener(string $sClassName): void
326
-    {
327
-        $this->xEventManager->addLibConfigListener($sClassName);
328
-    }
325
+public function addLibEventListener(string $sClassName): void
326
+{
327
+$this->xEventManager->addLibConfigListener($sClassName);
328
+}
329 329
 
330
-    /**
330
+/**
331 331
      * @param string $sClassName
332 332
      *
333 333
      * @return void
334 334
      */
335
-    public function addAppEventListener(string $sClassName): void
336
-    {
337
-        $this->xEventManager->addAppConfigListener($sClassName);
338
-    }
335
+public function addAppEventListener(string $sClassName): void
336
+{
337
+$this->xEventManager->addAppConfigListener($sClassName);
338
+}
339 339
 
340
-    /**
340
+/**
341 341
      * Make the helpers functions available in the global namespace.
342 342
      *
343 343
      * @param bool $bForce
344 344
      *
345 345
      * @return void
346 346
      */
347
-    public function globals(bool $bForce = false): void
348
-    {
349
-        if($bForce || $this->getAppOption('helpers.global', true))
350
-        {
351
-            require_once dirname(__DIR__, 2) . '/globals.php';
352
-        }
353
-    }
347
+public function globals(bool $bForce = false): void
348
+{
349
+if($bForce || $this->getAppOption('helpers.global', true))
350
+{
351
+require_once dirname(__DIR__, 2) . '/globals.php';
352
+}
353
+}
354 354
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/PageComponent.php 1 patch
Switch Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,53 +6,53 @@
 block discarded – undo
6 6
 
7 7
 abstract class PageComponent extends NodeComponent
8 8
 {
9
-    /**
9
+/**
10 10
      * The current page number.
11 11
      *
12 12
      * @var int
13 13
      */
14
-    private int $currentPage = 1;
14
+private int $currentPage = 1;
15 15
 
16
-    /**
16
+/**
17 17
      * Get the total number of items to paginate.
18 18
      *
19 19
      * @return int
20 20
      */
21
-    abstract protected function count(): int;
21
+abstract protected function count(): int;
22 22
 
23
-    /**
23
+/**
24 24
      * Get the max number of items per page.
25 25
      *
26 26
      * @return int
27 27
      */
28
-    abstract protected function limit(): int;
28
+abstract protected function limit(): int;
29 29
 
30
-    /**
30
+/**
31 31
      * Get the paginator for the component.
32 32
      *
33 33
      * @param int $pageNumber
34 34
      *
35 35
      * @return Paginator
36 36
      */
37
-    protected function paginator(int $pageNumber): Paginator
38
-    {
39
-        return $this->cl(Component\Pagination::class)
40
-            // Use the js class name as component item identifier.
41
-            ->item($this->rq()->_class())
42
-            ->paginator($pageNumber > 0 ? $pageNumber : 1, $this->limit(), $this->count())
43
-            // This callback will receive the final value of the current page number.
44
-            ->page(function(int $currentPage) {
45
-                $this->currentPage = $currentPage;
46
-            });
47
-    }
37
+protected function paginator(int $pageNumber): Paginator
38
+{
39
+return $this->cl(Component\Pagination::class)
40
+// Use the js class name as component item identifier.
41
+->item($this->rq()->_class())
42
+->paginator($pageNumber > 0 ? $pageNumber : 1, $this->limit(), $this->count())
43
+// This callback will receive the final value of the current page number.
44
+->page(function(int $currentPage) {
45
+    $this->currentPage = $currentPage;
46
+});
47
+}
48 48
 
49
-    /**
49
+/**
50 50
      * Get the current page number
51 51
      *
52 52
      * @return int
53 53
      */
54
-    protected function currentPage(): int
55
-    {
56
-        return $this->currentPage;
57
-    }
54
+protected function currentPage(): int
55
+{
56
+return $this->currentPage;
57
+}
58 58
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/PageDatabagTrait.php 1 patch
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,81 +6,81 @@
 block discarded – undo
6 6
 
7 7
 trait PageDatabagTrait
8 8
 {
9
-    /**
9
+/**
10 10
      * The current page number.
11 11
      *
12 12
      * @var int
13 13
      */
14
-    private int $currentPage = 1;
14
+private int $currentPage = 1;
15 15
 
16
-    /**
16
+/**
17 17
      * Get the pagination databag name.
18 18
      *
19 19
      * @return string
20 20
      */
21
-    abstract protected function bagName(): string;
21
+abstract protected function bagName(): string;
22 22
 
23
-    /**
23
+/**
24 24
      * Get the pagination databag attribute.
25 25
      *
26 26
      * @return string
27 27
      */
28
-    abstract protected function bagAttr(): string;
28
+abstract protected function bagAttr(): string;
29 29
 
30
-    /**
30
+/**
31 31
      * Get the page number.
32 32
      *
33 33
      * @param int $pageNumber
34 34
      *
35 35
      * @return int
36 36
      */
37
-    private function getPageNumber(int $pageNumber): int
38
-    {
39
-        // If no page number is provided, then get the value from the databag.
40
-        return $pageNumber > 0 ? $pageNumber :
41
-            (int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
42
-    }
37
+private function getPageNumber(int $pageNumber): int
38
+{
39
+// If no page number is provided, then get the value from the databag.
40
+return $pageNumber > 0 ? $pageNumber :
41
+(int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
42
+}
43 43
 
44
-    /**
44
+/**
45 45
      * Set the page number.
46 46
      *
47 47
      * @param int $currentPage
48 48
      *
49 49
      * @return void
50 50
      */
51
-    private function setCurrentPage(int $currentPage): void
52
-    {
53
-        // Save the current page in the databag.
54
-        $this->bag($this->bagName())->set($this->bagAttr(), $currentPage);
55
-        $this->currentPage = $currentPage;
56
-    }
51
+private function setCurrentPage(int $currentPage): void
52
+{
53
+// Save the current page in the databag.
54
+$this->bag($this->bagName())->set($this->bagAttr(), $currentPage);
55
+$this->currentPage = $currentPage;
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * Get the paginator for the component.
60 60
      *
61 61
      * @param int $pageNumber
62 62
      *
63 63
      * @return Paginator
64 64
      */
65
-    protected function paginator(int $pageNumber): Paginator
66
-    {
67
-        return $this->cl(Component\Pagination::class)
68
-            // Use the js class name as component item identifier.
69
-            ->item($this->rq()->_class())
70
-            ->paginator($this->getPageNumber($pageNumber), $this->limit(), $this->count())
71
-            // This callback will receive the final value of the current page number.
72
-            ->page(function(int $currentPage) {
73
-                $this->setCurrentPage($currentPage);
74
-            });
75
-    }
65
+protected function paginator(int $pageNumber): Paginator
66
+{
67
+return $this->cl(Component\Pagination::class)
68
+// Use the js class name as component item identifier.
69
+->item($this->rq()->_class())
70
+->paginator($this->getPageNumber($pageNumber), $this->limit(), $this->count())
71
+// This callback will receive the final value of the current page number.
72
+->page(function(int $currentPage) {
73
+    $this->setCurrentPage($currentPage);
74
+});
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * Get the current page number
79 79
      *
80 80
      * @return int
81 81
      */
82
-    protected function currentPage(): int
83
-    {
84
-        return $this->currentPage;
85
-    }
82
+protected function currentPage(): int
83
+{
84
+return $this->currentPage;
85
+}
86 86
 }
Please login to merge, or discard this patch.
jaxon-core/src/jaxon_fn.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function jaxon(): Jaxon
23 23
 {
24
-    return Jaxon::getInstance();
24
+return Jaxon::getInstance();
25 25
 }
Please login to merge, or discard this patch.
jaxon-core/src/Exception/Exception.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 
17 17
 class Exception extends \Exception
18 18
 {
19
-    public function __construct(string $sMessage)
20
-    {
21
-        parent::__construct($sMessage);
22
-    }
19
+public function __construct(string $sMessage)
20
+{
21
+parent::__construct($sMessage);
22
+}
23 23
 }
Please login to merge, or discard this patch.