Passed
Push — master ( 417a35...0ba0fc )
by Thierry
02:47
created
src/Plugin/Response/Dialog/DialogPlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
      */
127 127
     private function getLibraries(): array
128 128
     {
129
-        if($this->aLibraries === null)
129
+        if ($this->aLibraries === null)
130 130
         {
131 131
             $this->aLibraries = $this->xLibraryManager->getLibraries();
132 132
         }
Please login to merge, or discard this patch.
src/Plugin/Response/JQuery/DomSelector.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -60,11 +60,11 @@  discard block
 block discarded – undo
60 60
         $sContext = trim($sContext, " \t");
61 61
         $this->aCalls = [];
62 62
 
63
-        if(!$sPath)
63
+        if (!$sPath)
64 64
         {
65 65
             $this->sPath = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead
66 66
         }
67
-        elseif(($sContext))
67
+        elseif (($sContext))
68 68
         {
69 69
             $this->sPath = "$jQueryNs('" . $sPath . "', $jQueryNs('" . $sContext . "'))";
70 70
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function getScript(): string
130 130
     {
131
-        if(count($this->aCalls) === 0)
131
+        if (count($this->aCalls) === 0)
132 132
         {
133 133
             return $this->sPath;
134 134
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,12 +63,10 @@
 block discarded – undo
63 63
         if(!$sPath)
64 64
         {
65 65
             $this->sPath = "$jQueryNs(this)"; // If an empty selector is given, use javascript "this" instead
66
-        }
67
-        elseif(($sContext))
66
+        } elseif(($sContext))
68 67
         {
69 68
             $this->sPath = "$jQueryNs('" . $sPath . "', $jQueryNs('" . $sContext . "'))";
70
-        }
71
-        else
69
+        } else
72 70
         {
73 71
             $this->sPath = "$jQueryNs('" . $sPath . "')";
74 72
         }
Please login to merge, or discard this patch.
src/Plugin/Response/JQuery/JQueryPlugin.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
     public function selector(string $sPath = '', string $sContext = ''): DomSelector
88 88
     {
89 89
         $xSelector = new DomSelector($this->jQueryNs, $sPath, $sContext);
90
-        if($this->bCommand && $this->response() !== null)
90
+        if ($this->bCommand && $this->response() !== null)
91 91
         {
92 92
             $this->addCommand(['cmd' => 'jquery'], $xSelector);
93 93
         }
Please login to merge, or discard this patch.
src/Plugin/Code/AssetManager.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function shallIncludeAssets(Plugin $xPlugin): bool
72 72
     {
73
-        if($this->xConfigManager->getOption('assets.include.all', true))
73
+        if ($this->xConfigManager->getOption('assets.include.all', true))
74 74
         {
75 75
             return true;
76 76
         }
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $sJsLibUri = rtrim($this->xConfigManager->getOption('js.lib.uri', self::JS_LIB_URL), '/') . '/';
91 91
         // Add component files to the javascript file array;
92 92
         $aJsFiles = [$sJsLibUri . 'jaxon.core' . $sJsExtension];
93
-        if($this->xConfigManager->getOption('core.debug.on'))
93
+        if ($this->xConfigManager->getOption('core.debug.on'))
94 94
         {
95 95
             $sLanguage = $this->xConfigManager->getOption('core.language');
96 96
             $aJsFiles[] = $sJsLibUri . 'jaxon.debug' . $sJsExtension;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
      */
108 108
     public function getOptionVars(): array
109 109
     {
110
-        if(!$this->xConfigManager->hasOption('core.request.uri'))
110
+        if (!$this->xConfigManager->hasOption('core.request.uri'))
111 111
         {
112 112
             $this->xConfigManager->setOption('core.request.uri', $this->xParameterReader->uri());
113 113
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
         // Check config options
141 141
         // - The js.app.export option must be set to true
142 142
         // - The js.app.uri and js.app.dir options must be set to non null values
143
-        if(!$this->xConfigManager->getOption('js.app.export', false) ||
143
+        if (!$this->xConfigManager->getOption('js.app.export', false) ||
144 144
             !$this->xConfigManager->hasOption('js.app.uri') ||
145 145
             !$this->xConfigManager->hasOption('js.app.dir'))
146 146
         {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $sJsFileName = $this->xConfigManager->getOption('js.app.file', $sHash);
164 164
         $sJsDirectory = rtrim($this->xConfigManager->getOption('js.app.dir'), '\/') . DIRECTORY_SEPARATOR;
165 165
         // - The js.app.dir must be writable
166
-        if(!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory))
166
+        if (!$sJsFileName || !is_dir($sJsDirectory) || !is_writable($sJsDirectory))
167 167
         {
168 168
             return '';
169 169
         }
@@ -171,15 +171,15 @@  discard block
 block discarded – undo
171 171
         $sJsFilePath = $sJsDirectory . $sJsFileName . '.js';
172 172
         $sJsMinFilePath = $sJsDirectory . $sJsFileName . '.min.js';
173 173
         $sJsFileUri = rtrim($this->xConfigManager->getOption('js.app.uri'), '/') . "/$sJsFileName";
174
-        if(!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $sJsCode))
174
+        if (!is_file($sJsFilePath) && !@file_put_contents($sJsFilePath, $sJsCode))
175 175
         {
176 176
             return '';
177 177
         }
178
-        if(!$this->xConfigManager->getOption('js.app.minify', false))
178
+        if (!$this->xConfigManager->getOption('js.app.minify', false))
179 179
         {
180 180
             return $sJsFileUri . '.js';
181 181
         }
182
-        if(!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath))
182
+        if (!is_file($sJsMinFilePath) && !$this->xMinifier->minify($sJsFilePath, $sJsMinFilePath))
183 183
         {
184 184
             // If the file cannot be minified, return the plain js file.
185 185
             return $sJsFileUri . '.js';
Please login to merge, or discard this patch.
src/Plugin/Code/CodeGenerator.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     private function generatePluginCodes(string $sClassName)
142 142
     {
143 143
         $xGenerator = $this->di->g($sClassName);
144
-        if(!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator))
144
+        if (!is_subclass_of($xGenerator, Plugin::class) || $this->xAssetManager->shallIncludeAssets($xGenerator))
145 145
         {
146 146
             // HTML tags for CSS
147 147
             $this->sCss = trim($this->sCss) . "\n" . trim($xGenerator->getCss(), " \n");
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         }
151 151
         // Javascript code
152 152
         $this->sJsScript = trim($this->sJsScript) . "\n\n" . trim($xGenerator->getScript(), " \n");
153
-        if($xGenerator->readyEnabled())
153
+        if ($xGenerator->readyEnabled())
154 154
         {
155 155
             $sScriptAttr = $xGenerator->readyInlined() ? 'sJsInlineScript' : 'sJsReadyScript';
156 156
             $this->$sScriptAttr = trim($this->$sScriptAttr) . "\n\n" . trim($xGenerator->getReadyScript(), " \n");
@@ -169,11 +169,11 @@  discard block
 block discarded – undo
169 169
         $this->sJsScript = trim($this->sJsScript, " \n");
170 170
         $this->sJsReadyScript = trim($this->sJsReadyScript, " \n");
171 171
         $this->sJsInlineScript = trim($this->sJsInlineScript, " \n");
172
-        if(($this->sJsReadyScript))
172
+        if (($this->sJsReadyScript))
173 173
         {
174 174
             $this->sJsReadyScript = $this->render('ready.js', ['sScript' => $this->sJsReadyScript . "\n"]);
175 175
         }
176
-        if(($this->sJsInlineScript))
176
+        if (($this->sJsInlineScript))
177 177
         {
178 178
             $this->sJsInlineScript = $this->render('ready.js', ['sScript' => $this->sJsInlineScript . "\n"]);
179 179
         }
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
      */
190 190
     private function generateCodes()
191 191
     {
192
-        if($this->bGenerated)
192
+        if ($this->bGenerated)
193 193
         {
194 194
             return;
195 195
         }
196 196
 
197 197
         $this->xAssetManager = $this->di->getAssetManager();
198 198
         $this->sJsOptions = $this->xAssetManager->getJsOptions();
199
-        foreach($this->xPluginManager->getCodeGenerators() as $sClassName)
199
+        foreach ($this->xPluginManager->getCodeGenerators() as $sClassName)
200 200
         {
201 201
             $this->generatePluginCodes($sClassName);
202 202
         }
@@ -241,11 +241,11 @@  discard block
 block discarded – undo
241 241
     {
242 242
         $this->generateCodes();
243 243
         $sScript = '';
244
-        if(($bIncludeCss))
244
+        if (($bIncludeCss))
245 245
         {
246 246
             $sScript .= $this->getCss() . "\n";
247 247
         }
248
-        if(($bIncludeJs))
248
+        if (($bIncludeJs))
249 249
         {
250 250
             $sScript .= $this->getJs() . "\n";
251 251
         }
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $sJsConfigVars = $this->render('config.js', $this->xAssetManager->getOptionVars());
254 254
         // These three parts are always rendered together
255 255
         $sJsScript = trim($sJsConfigVars) . "\n\n" . trim($this->sJsScript) . "\n\n" . trim($this->sJsReadyScript);
256
-        if($this->xAssetManager->shallCreateJsFiles() &&
256
+        if ($this->xAssetManager->shallCreateJsFiles() &&
257 257
             ($sUrl = $this->xAssetManager->createJsFiles($this->getHash(), $sJsScript)))
258 258
         {
259 259
             return trim($sScript) . "\n\n" . trim($this->render('include.js', ['sUrl' => $sUrl])) . "\n\n" .
Please login to merge, or discard this patch.
src/Plugin/Manager/PluginManager.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     public function addCodeGenerator(string $sClassName, int $nPriority)
106 106
     {
107
-        while(isset($this->aCodeGenerators[$nPriority]))
107
+        while (isset($this->aCodeGenerators[$nPriority]))
108 108
         {
109 109
             $nPriority++;
110 110
         }
@@ -152,28 +152,28 @@  discard block
 block discarded – undo
152 152
     {
153 153
         $bIsUsed = false;
154 154
         $aInterfaces = class_implements($sClassName);
155
-        if(in_array(CodeGeneratorInterface::class, $aInterfaces))
155
+        if (in_array(CodeGeneratorInterface::class, $aInterfaces))
156 156
         {
157 157
             $this->addCodeGenerator($sClassName, $nPriority);
158 158
             $bIsUsed = true;
159 159
         }
160
-        if(in_array(CallableRegistryInterface::class, $aInterfaces))
160
+        if (in_array(CallableRegistryInterface::class, $aInterfaces))
161 161
         {
162 162
             $this->aRegistryPlugins[$sPluginName] = $sClassName;
163 163
             $bIsUsed = true;
164 164
         }
165
-        if(in_array(RequestHandlerInterface::class, $aInterfaces))
165
+        if (in_array(RequestHandlerInterface::class, $aInterfaces))
166 166
         {
167 167
             $this->aRequestHandlers[$sPluginName] = $sClassName;
168 168
             $bIsUsed = true;
169 169
         }
170
-        if(in_array(ResponsePluginInterface::class, $aInterfaces))
170
+        if (in_array(ResponsePluginInterface::class, $aInterfaces))
171 171
         {
172 172
             $this->aResponsePlugins[$sPluginName] = $sClassName;
173 173
             $bIsUsed = true;
174 174
         }
175 175
 
176
-        if(!$bIsUsed)
176
+        if (!$bIsUsed)
177 177
         {
178 178
             // The class is invalid.
179 179
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         }
182 182
 
183 183
         // Register the plugin in the DI container, if necessary
184
-        if(!$this->di->has($sClassName))
184
+        if (!$this->di->has($sClassName))
185 185
         {
186 186
             $this->di->auto($sClassName);
187 187
         }
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
      */
198 198
     public function getResponsePlugin(string $sName, ?Response $xResponse = null): ?ResponsePlugin
199 199
     {
200
-        if(!isset($this->aResponsePlugins[$sName]))
200
+        if (!isset($this->aResponsePlugins[$sName]))
201 201
         {
202 202
             return null;
203 203
         }
204 204
         $xPlugin = $this->di->g($this->aResponsePlugins[$sName]);
205
-        if(($xResponse))
205
+        if (($xResponse))
206 206
         {
207 207
             $xPlugin->setResponse($xResponse);
208 208
         }
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function registerCallable(string $sType, string $sCallable, $xOptions = [])
225 225
     {
226
-        if(isset($this->aRegistryPlugins[$sType]) &&
226
+        if (isset($this->aRegistryPlugins[$sType]) &&
227 227
             ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType])))
228 228
         {
229 229
             $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions));
Please login to merge, or discard this patch.
src/Plugin/Manager/PackageManager.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -85,28 +85,28 @@  discard block
 block discarded – undo
85 85
     private function updateContainer(Config $xConfig)
86 86
     {
87 87
         $aOptions = $xConfig->getOption('container.set', []);
88
-        foreach($aOptions as $xKey => $xValue)
88
+        foreach ($aOptions as $xKey => $xValue)
89 89
         {
90 90
             // The key is the class name. It must be a string.
91
-            $this->di->set((string)$xKey, $xValue);
91
+            $this->di->set((string) $xKey, $xValue);
92 92
         }
93 93
         $aOptions = $xConfig->getOption('container.val', []);
94
-        foreach($aOptions as $xKey => $xValue)
94
+        foreach ($aOptions as $xKey => $xValue)
95 95
         {
96 96
             // The key is the class name. It must be a string.
97
-            $this->di->val((string)$xKey, $xValue);
97
+            $this->di->val((string) $xKey, $xValue);
98 98
         }
99 99
         $aOptions = $xConfig->getOption('container.auto', []);
100
-        foreach($aOptions as $xValue)
100
+        foreach ($aOptions as $xValue)
101 101
         {
102 102
             // The key is the class name. It must be a string.
103
-            $this->di->auto((string)$xValue);
103
+            $this->di->auto((string) $xValue);
104 104
         }
105 105
         $aOptions = $xConfig->getOption('container.alias', []);
106
-        foreach($aOptions as $xKey => $xValue)
106
+        foreach ($aOptions as $xKey => $xValue)
107 107
         {
108 108
             // The key is the class name. It must be a string.
109
-            $this->di->alias((string)$xKey, (string)$xValue);
109
+            $this->di->alias((string) $xKey, (string) $xValue);
110 110
         }
111 111
     }
112 112
 
@@ -121,14 +121,14 @@  discard block
 block discarded – undo
121 121
      */
122 122
     private function registerCallables(array $aOptions, string $sCallableType)
123 123
     {
124
-        foreach($aOptions as $xKey => $xValue)
124
+        foreach ($aOptions as $xKey => $xValue)
125 125
         {
126
-            if(is_integer($xKey) && is_string($xValue))
126
+            if (is_integer($xKey) && is_string($xValue))
127 127
             {
128 128
                 // Register a function without options
129 129
                 $this->xPluginManager->registerCallable($sCallableType, $xValue);
130 130
             }
131
-            elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
131
+            elseif (is_string($xKey) && (is_array($xValue) || is_string($xValue)))
132 132
             {
133 133
                 // Register a function with options
134 134
                 $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue);
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
     {
172 172
         // $this->aPackages contains packages config file paths.
173 173
         $aLibOptions = $sClassName::config();
174
-        if(is_string($aLibOptions))
174
+        if (is_string($aLibOptions))
175 175
         {
176 176
             // A string is supposed to be the path to a config file.
177 177
             $aLibOptions = $this->xConfigManager->read($aLibOptions);
178 178
         }
179
-        elseif(!is_array($aLibOptions))
179
+        elseif (!is_array($aLibOptions))
180 180
         {
181 181
             // Otherwise, anything else than an array is not accepted.
182 182
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
     public function registerPackage(string $sClassName, array $aUserOptions)
198 198
     {
199 199
         $sClassName = trim($sClassName, '\\ ');
200
-        if(!is_subclass_of($sClassName, Package::class))
200
+        if (!is_subclass_of($sClassName, Package::class))
201 201
         {
202 202
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
203 203
             throw new SetupException($sMessage);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
         // Register packages
243 243
         $aPackageConfig = $xAppConfig->getOption('packages', []);
244
-        foreach($aPackageConfig as $sClassName => $aPkgOptions)
244
+        foreach ($aPackageConfig as $sClassName => $aPkgOptions)
245 245
         {
246 246
             $this->registerPackage($sClassName, $aPkgOptions);
247 247
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -127,8 +127,7 @@  discard block
 block discarded – undo
127 127
             {
128 128
                 // Register a function without options
129 129
                 $this->xPluginManager->registerCallable($sCallableType, $xValue);
130
-            }
131
-            elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
130
+            } elseif(is_string($xKey) && (is_array($xValue) || is_string($xValue)))
132 131
             {
133 132
                 // Register a function with options
134 133
                 $this->xPluginManager->registerCallable($sCallableType, $xKey, $xValue);
@@ -175,8 +174,7 @@  discard block
 block discarded – undo
175 174
         {
176 175
             // A string is supposed to be the path to a config file.
177 176
             $aLibOptions = $this->xConfigManager->read($aLibOptions);
178
-        }
179
-        elseif(!is_array($aLibOptions))
177
+        } elseif(!is_array($aLibOptions))
180 178
         {
181 179
             // Otherwise, anything else than an array is not accepted.
182 180
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
Please login to merge, or discard this patch.
src/Request/Factory/Factory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@
 block discarded – undo
62 62
     public function request(string $sClassName = ''): ?RequestFactory
63 63
     {
64 64
         $sClassName = trim($sClassName);
65
-        if(!$sClassName)
65
+        if (!$sClassName)
66 66
         {
67 67
             // There is a single request factory for all callable functions.
68 68
             return $this->xRequestFactory->noPrefix(false);
69 69
         }
70
-        if($sClassName === '.')
70
+        if ($sClassName === '.')
71 71
         {
72 72
             // The request factory is for a js function, not a Jaxon call.
73 73
             return $this->xRequestFactory->noPrefix(true);
Please login to merge, or discard this patch.