Passed
Push — master ( 417a35...0ba0fc )
by Thierry
02:47
created
src/App/Bootstrap.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
         // Jaxon library settings
118 118
         $this->xConfigManager->setOption('js.app.export', $bExport);
119 119
         $this->xConfigManager->setOption('js.app.minify', $bMinify);
120
-        if($sUri !== '')
120
+        if ($sUri !== '')
121 121
         {
122 122
             $this->xConfigManager->setOption('js.app.uri', $sUri);
123 123
         }
124
-        if($sDir !== '')
124
+        if ($sDir !== '')
125 125
         {
126 126
             $this->xConfigManager->setOption('js.app.dir', $sDir);
127 127
         }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
     {
174 174
         // Only call the callbacks that aren't called yet.
175 175
         $aBootCallbacks = $this->xCallbackManager->popBootCallbacks();
176
-        foreach($aBootCallbacks as $aBootCallback)
176
+        foreach ($aBootCallbacks as $aBootCallback)
177 177
         {
178 178
             call_user_func($aBootCallback);
179 179
         }
Please login to merge, or discard this patch.
src/App/View/TemplateView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
         $sViewName = $store->getViewName();
49 49
         $sNamespace = $store->getNamespace();
50 50
         // In this view renderer, the namespace must always be prepended to the view name.
51
-        if(substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
51
+        if (substr($sViewName, 0, strlen($sNamespace) + 2) != $sNamespace . '::')
52 52
         {
53 53
             $sViewName = $sNamespace . '::' . $sViewName;
54 54
         }
Please login to merge, or discard this patch.
src/App/View/ViewRenderer.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -89,24 +89,24 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function addNamespaces(Config $xAppConfig, ?Config $xUserConfig = null)
91 91
     {
92
-        if(empty($aNamespaces = $xAppConfig->getOptionNames('views')))
92
+        if (empty($aNamespaces = $xAppConfig->getOptionNames('views')))
93 93
         {
94 94
             return;
95 95
         }
96 96
         $sPackage = $xAppConfig->getOption('package', '');
97
-        foreach($aNamespaces as $sNamespace => $sOption)
97
+        foreach ($aNamespaces as $sNamespace => $sOption)
98 98
         {
99 99
             // Save the namespace
100 100
             $aNamespace = $xAppConfig->getOption($sOption);
101 101
             $aNamespace['package'] = $sPackage;
102
-            if(!isset($aNamespace['renderer']))
102
+            if (!isset($aNamespace['renderer']))
103 103
             {
104 104
                 $aNamespace['renderer'] = 'jaxon'; // 'jaxon' is the default renderer.
105 105
             }
106 106
 
107 107
             // If the lib config has defined a template option, then its value must be
108 108
             // read from the app config.
109
-            if($xUserConfig !== null && isset($aNamespace['template']) && is_array($aNamespace['template']))
109
+            if ($xUserConfig !== null && isset($aNamespace['template']) && is_array($aNamespace['template']))
110 110
             {
111 111
                 $sTemplateOption = $xAppConfig->getOption($sOption . '.template.option');
112 112
                 $sTemplateDefault = $xAppConfig->getOption($sOption . '.template.default');
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             $aNamespaces = array_filter($this->aNamespaces, function($aNamespace) use($sId) {
150 150
                 return $aNamespace['renderer'] === $sId;
151 151
             });
152
-            foreach($aNamespaces as $sNamespace => $aNamespace)
152
+            foreach ($aNamespaces as $sNamespace => $aNamespace)
153 153
             {
154 154
                 $xRenderer->addNamespace($sNamespace, $aNamespace['directory'], $aNamespace['extension']);
155 155
             }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function getNamespaceRenderer(string $sNamespace): ?ViewInterface
184 184
     {
185
-        if(!isset($this->aNamespaces[$sNamespace]))
185
+        if (!isset($this->aNamespaces[$sNamespace]))
186 186
         {
187 187
             return null;
188 188
         }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      */
208 208
     protected function store(): Store
209 209
     {
210
-        if(!$this->xStore)
210
+        if (!$this->xStore)
211 211
         {
212 212
             $this->xStore = new Store();
213 213
         }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function shareValues(array $aValues): ViewRenderer
253 253
     {
254
-        foreach($aValues as $sName => $xValue)
254
+        foreach ($aValues as $sName => $xValue)
255 255
         {
256 256
             $this->share($sName, $xValue);
257 257
         }
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
         $sNamespace = $this->sDefaultNamespace;
276 276
         // Get the namespace from the view name
277 277
         $nSeparatorPosition = strrpos($sViewName, '::');
278
-        if($nSeparatorPosition !== false)
278
+        if ($nSeparatorPosition !== false)
279 279
         {
280 280
             $sNamespace = substr($sViewName, 0, $nSeparatorPosition);
281 281
         }
282 282
         $xRenderer = $this->getNamespaceRenderer($sNamespace);
283
-        if(!$xRenderer)
283
+        if (!$xRenderer)
284 284
         {
285 285
             // Cannot render a view if there's no renderer corresponding to the namespace.
286 286
             return null;
Please login to merge, or discard this patch.
src/App/Dialog/Library/AlertLibrary.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
      */
44 44
     public function confirm(string $sQuestion, string $sYesScript, string $sNoScript): string
45 45
     {
46
-        return empty($sNoScript) ? 'if(confirm(' . $sQuestion . ')){' . $sYesScript . ';}' :
47
-            'if(confirm(' . $sQuestion . ')){' . $sYesScript . ';}else{' . $sNoScript . ';}';
46
+        return empty($sNoScript) ? 'if(confirm(' . $sQuestion . ')){' . $sYesScript . ';}' : 'if(confirm(' . $sQuestion . ')){' . $sYesScript . ';}else{' . $sNoScript . ';}';
48 47
     }
49 48
 
50 49
     /**
@@ -57,11 +56,11 @@  discard block
 block discarded – undo
57 56
      */
58 57
     private function alert(string $sMessage, string $sTitle): string
59 58
     {
60
-        if(!empty($sTitle))
59
+        if (!empty($sTitle))
61 60
         {
62 61
             $sMessage = '<b>' . $sTitle . '</b><br/>' . $sMessage;
63 62
         }
64
-        if($this->returnCode())
63
+        if ($this->returnCode())
65 64
         {
66 65
             return 'alert(' . $sMessage . ')';
67 66
         }
Please login to merge, or discard this patch.
src/App/Dialog/Library/DialogLibraryManager.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -123,19 +123,19 @@  discard block
 block discarded – undo
123 123
     {
124 124
         $bIsUsed = false;
125 125
         $aInterfaces = class_implements($sClassName);
126
-        if(in_array(QuestionInterface::class, $aInterfaces))
126
+        if (in_array(QuestionInterface::class, $aInterfaces))
127 127
         {
128 128
             $this->aQuestionLibraries[$sLibraryName] = $bIsUsed = true;
129 129
         }
130
-        if(in_array(MessageInterface::class, $aInterfaces))
130
+        if (in_array(MessageInterface::class, $aInterfaces))
131 131
         {
132 132
             $this->aMessageLibraries[$sLibraryName] = $bIsUsed = true;
133 133
         }
134
-        if(in_array(ModalInterface::class, $aInterfaces))
134
+        if (in_array(ModalInterface::class, $aInterfaces))
135 135
         {
136 136
             $this->aModalLibraries[$sLibraryName] = $bIsUsed = true;
137 137
         }
138
-        if(!$bIsUsed)
138
+        if (!$bIsUsed)
139 139
         {
140 140
             // The class is invalid.
141 141
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
      */
168 168
     public function setQuestionLibrary(string $sLibraryName)
169 169
     {
170
-        if(!isset($this->aQuestionLibraries[$sLibraryName]))
170
+        if (!isset($this->aQuestionLibraries[$sLibraryName]))
171 171
         {
172 172
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
173 173
                 ['type' => 'question', 'name' => $sLibraryName]);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function setMessageLibrary(string $sLibraryName)
199 199
     {
200
-        if(!isset($this->aMessageLibraries[$sLibraryName]))
200
+        if (!isset($this->aMessageLibraries[$sLibraryName]))
201 201
         {
202 202
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
203 203
                 ['type' => 'message', 'name' => $sLibraryName]);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function setModalLibrary(string $sLibraryName)
229 229
     {
230
-        if(!isset($this->aModalLibraries[$sLibraryName]))
230
+        if (!isset($this->aModalLibraries[$sLibraryName]))
231 231
         {
232 232
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
233 233
                 ['type' => 'modal', 'name' => $sLibraryName]);
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     protected function registerLibraries()
269 269
     {
270 270
         $aLibraries = $this->xConfigManager->getOption('dialogs.classes', []);
271
-        foreach($aLibraries as $sLibraryName => $sClassName)
271
+        foreach ($aLibraries as $sLibraryName => $sClassName)
272 272
         {
273 273
             $this->registerLibrary($sClassName, $sLibraryName);
274 274
         }
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     protected function updateLibraries()
283 283
     {
284 284
         $aLibraries = $this->xConfigManager->getOption('dialogs.libraries', []);
285
-        foreach($aLibraries as $sLibraryName)
285
+        foreach ($aLibraries as $sLibraryName)
286 286
         {
287 287
             $this->aLibraries[$sLibraryName] = true;
288 288
         }
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
     protected function setDefaultLibraries()
298 298
     {
299 299
         // Set the default modal library
300
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', '')))
300
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.modal', '')))
301 301
         {
302 302
             $this->setModalLibrary($sLibraryName);
303 303
         }
304 304
         // Set the default message library
305
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', '')))
305
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.message', '')))
306 306
         {
307 307
             $this->setMessageLibrary($sLibraryName);
308 308
         }
309 309
         // Set the default question library
310
-        if(($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', '')))
310
+        if (($sLibraryName = $this->xConfigManager->getOption('dialogs.default.question', '')))
311 311
         {
312 312
             $this->setQuestionLibrary($sLibraryName);
313 313
         }
@@ -331,17 +331,17 @@  discard block
 block discarded – undo
331 331
      */
332 332
     public function onChange(Config $xConfig, string $sName)
333 333
     {
334
-        if(substr($sName, 0, 15) === 'dialogs.classes')
334
+        if (substr($sName, 0, 15) === 'dialogs.classes')
335 335
         {
336 336
             $this->registerLibraries();
337 337
             return;
338 338
         }
339
-        if($sName === 'dialogs.libraries')
339
+        if ($sName === 'dialogs.libraries')
340 340
         {
341 341
             $this->updateLibraries();
342 342
             return;
343 343
         }
344
-        if(substr($sName, 0, 15) === 'dialogs.default')
344
+        if (substr($sName, 0, 15) === 'dialogs.default')
345 345
         {
346 346
             $this->setDefaultLibraries();
347 347
         }
Please login to merge, or discard this patch.
src/App/Dialog/Library/DialogLibraryHelper.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -136,18 +136,18 @@
 block discarded – undo
136 136
         $aOptions = $this->getOptionNames($sKeyPrefix);
137 137
         $sSpaces = str_repeat(' ', $nSpaces);
138 138
         $sScript = '';
139
-        foreach($aOptions as $sShortName => $sFullName)
139
+        foreach ($aOptions as $sShortName => $sFullName)
140 140
         {
141 141
             $value = $this->xConfigManager->getOption($sFullName);
142
-            if(is_string($value))
142
+            if (is_string($value))
143 143
             {
144 144
                 $value = "'$value'";
145 145
             }
146
-            elseif(is_bool($value))
146
+            elseif (is_bool($value))
147 147
             {
148 148
                 $value = ($value ? 'true' : 'false');
149 149
             }
150
-            elseif(!is_numeric($value))
150
+            elseif (!is_numeric($value))
151 151
             {
152 152
                 $value = json_encode($value);
153 153
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -142,12 +142,10 @@
 block discarded – undo
142 142
             if(is_string($value))
143 143
             {
144 144
                 $value = "'$value'";
145
-            }
146
-            elseif(is_bool($value))
145
+            } elseif(is_bool($value))
147 146
             {
148 147
                 $value = ($value ? 'true' : 'false');
149
-            }
150
-            elseif(!is_numeric($value))
148
+            } elseif(!is_numeric($value))
151 149
             {
152 150
                 $value = json_encode($value);
153 151
             }
Please login to merge, or discard this patch.
src/App/Ajax.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public static function getInstance(): Ajax
85 85
     {
86
-        if(self::$xInstance === null)
86
+        if (self::$xInstance === null)
87 87
         {
88 88
             // First call: create and initialize the instances.
89 89
             self::$xInstance = new Ajax();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
      */
122 122
     public function config(string $sConfigFile = '', string $sConfigSection = ''): ConfigManager
123 123
     {
124
-        if(!empty(($sConfigFile = trim($sConfigFile))))
124
+        if (!empty(($sConfigFile = trim($sConfigFile))))
125 125
         {
126 126
             $this->xConfigManager->load($sConfigFile, trim($sConfigSection));
127 127
         }
Please login to merge, or discard this patch.
src/App/Traits/AjaxSendTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
      */
34 34
     public function sendResponse()
35 35
     {
36
-        if(!$this->xConfigManager->getOption('core.response.send', false))
36
+        if (!$this->xConfigManager->getOption('core.response.send', false))
37 37
         {
38 38
             return;
39 39
         }
40 40
 
41 41
         // Check to see if headers have already been sent out, in which case we can't do our job
42
-        if(headers_sent($sFilename, $nLineNumber))
42
+        if (headers_sent($sFilename, $nLineNumber))
43 43
         {
44 44
             throw new RequestException($this->xTranslator->trans('errors.output.already-sent',
45 45
                     ['location' => $sFilename . ':' . $nLineNumber]) . "\n" .
46 46
                 $this->xTranslator->trans('errors.output.advice'));
47 47
         }
48
-        if(empty($sContent = $this->xResponseManager->getOutput()))
48
+        if (empty($sContent = $this->xResponseManager->getOutput()))
49 49
         {
50 50
             return;
51 51
         }
52 52
 
53
-        if($this->di()->getRequest()->getMethod() === 'GET')
53
+        if ($this->di()->getRequest()->getMethod() === 'GET')
54 54
         {
55 55
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
56 56
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
         print $sContent;
63 63
 
64
-        if($this->xConfigManager->getOption('core.process.exit', false))
64
+        if ($this->xConfigManager->getOption('core.process.exit', false))
65 65
         {
66 66
             exit();
67 67
         }
Please login to merge, or discard this patch.
src/App/CallableClass.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     public function cl(string $sName)
36 36
     {
37 37
         $xCallableClass = $this->xCallableClassHelper->xCallableRegistry->getCallableObject($sName);
38
-        if($xCallableClass === null)
38
+        if ($xCallableClass === null)
39 39
         {
40 40
             return null;
41 41
         }
Please login to merge, or discard this patch.