Completed
Push — master ( 71f3ca...10d1fd )
by Thierry
01:44
created
src/Code/Generator.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
     /**
62 62
      * The constructor
63 63
      *
64
-     * @param   Jaxon\Plugin\Manager    $xPluginManager
64
+     * @param   Manager    $xPluginManager
65 65
      */
66 66
     public function __construct(Manager $xPluginManager)
67 67
     {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     private function getJsLibUri()
77 77
     {
78
-        if(!$this->hasOption('js.lib.uri'))
78
+        if (!$this->hasOption('js.lib.uri'))
79 79
         {
80 80
             // return 'https://cdn.jsdelivr.net/jaxon/1.2.0/';
81 81
             return 'https://cdn.jsdelivr.net/gh/jaxon-php/[email protected]/dist/';
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
         // The jsDelivr CDN only hosts minified files
99 99
         // if(($this->getOption('js.app.minify')) || substr($this->getJsLibUri(), 0, $nLen) == $jsDelivrUri)
100 100
         // Starting from version 2.0.0 of the js lib, the jsDelivr CDN also hosts non minified files.
101
-        if(($this->getOption('js.app.minify')))
101
+        if (($this->getOption('js.app.minify')))
102 102
         {
103 103
             return '.min.js';
104 104
         }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         // Check config options
116 116
         // - The js.app.extern option must be set to true
117 117
         // - The js.app.uri and js.app.dir options must be set to non null values
118
-        if(!$this->getOption('js.app.extern') ||
118
+        if (!$this->getOption('js.app.extern') ||
119 119
             !$this->getOption('js.app.uri') ||
120 120
             !$this->getOption('js.app.dir'))
121 121
         {
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         // Check dir access
125 125
         // - The js.app.dir must be writable
126 126
         $sJsAppDir = $this->getOption('js.app.dir');
127
-        if(!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
127
+        if (!is_dir($sJsAppDir) || !is_writable($sJsAppDir))
128 128
         {
129 129
             return false;
130 130
         }
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     private function setTemplateCacheDir()
140 140
     {
141
-        if($this->hasOption('core.template.cache_dir'))
141
+        if ($this->hasOption('core.template.cache_dir'))
142 142
         {
143 143
             $this->setCacheDir($this->getOption('core.template.cache_dir'));
144 144
         }
@@ -152,11 +152,11 @@  discard block
 block discarded – undo
152 152
     private function generateHash()
153 153
     {
154 154
         $sHash = jaxon()->getVersion();
155
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
155
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
156 156
         {
157 157
             $sHash .= $xPlugin->generateHash();
158 158
         }
159
-        foreach($this->xPluginManager->getResponsePlugins() as $xPlugin)
159
+        foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin)
160 160
         {
161 161
             $sHash .= $xPlugin->generateHash();
162 162
         }
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
      */
171 171
     private function makePluginsCode()
172 172
     {
173
-        if($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
173
+        if ($this->sCssCode === null || $this->sJsCode === null || $this->sJsReady === null)
174 174
         {
175 175
             $this->sCssCode = '';
176 176
             $this->sJsCode = '';
177 177
             $this->sJsReady = '';
178
-            foreach($this->xPluginManager->getResponsePlugins() as $xPlugin)
178
+            foreach ($this->xPluginManager->getResponsePlugins() as $xPlugin)
179 179
             {
180
-                if(($str = trim($xPlugin->getCss())))
180
+                if (($str = trim($xPlugin->getCss())))
181 181
                 {
182 182
                     $this->sCssCode .= rtrim($str, " \n") . "\n";
183 183
                 }
184
-                if(($str = trim($xPlugin->getJs())))
184
+                if (($str = trim($xPlugin->getJs())))
185 185
                 {
186 186
                     $this->sJsCode .= rtrim($str, " \n") . "\n";
187 187
                 }
188
-                if(($str = trim($xPlugin->getScript())))
188
+                if (($str = trim($xPlugin->getScript())))
189 189
                 {
190 190
                     $this->sJsReady .= "\n" . trim($str, " \n");
191 191
                 }
192 192
             }
193 193
 
194 194
             $this->sJsReady = $this->render('jaxon::plugins/ready.js', ['sPluginScript' => $this->sJsReady]);
195
-            foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
195
+            foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
196 196
             {
197
-                if(($str = trim($xPlugin->getScript())))
197
+                if (($str = trim($xPlugin->getScript())))
198 198
                 {
199 199
                     $this->sJsReady .= "\n" . trim($str, " \n");
200 200
                 }
201 201
             }
202 202
 
203
-            foreach($this->xPluginManager->getPackages() as $sClass)
203
+            foreach ($this->xPluginManager->getPackages() as $sClass)
204 204
             {
205 205
                 $xPackage = jaxon()->di()->get($sClass);
206
-                if(($str = trim($xPackage->css())))
206
+                if (($str = trim($xPackage->css())))
207 207
                 {
208 208
                     $this->sCssCode .= rtrim($str, " \n") . "\n";
209 209
                 }
210
-                if(($str = trim($xPackage->js())))
210
+                if (($str = trim($xPackage->js())))
211 211
                 {
212 212
                     $this->sJsCode .= rtrim($str, " \n") . "\n";
213 213
                 }
214 214
                 $xPackage = jaxon()->di()->get($sClass);
215
-                if(($str = trim($xPackage->ready())))
215
+                if (($str = trim($xPackage->ready())))
216 216
                 {
217 217
                     $this->sJsReady .= "\n" . trim($str, " \n");
218 218
                 }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
         // Add component files to the javascript file array;
238 238
         $aJsFiles = array($sJsCoreUrl);
239
-        if($this->getOption('core.debug.on'))
239
+        if ($this->getOption('core.debug.on'))
240 240
         {
241 241
             $aJsFiles[] = $sJsDebugUrl;
242 242
             $aJsFiles[] = $sJsLanguageUrl;
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $this->setTemplateCacheDir();
332 332
         $this->makePluginsCode();
333 333
 
334
-        if($this->canExportJavascript())
334
+        if ($this->canExportJavascript())
335 335
         {
336 336
             $sJsAppURI = rtrim($this->getOption('js.app.uri'), '/') . '/';
337 337
             $sJsAppDir = rtrim($this->getOption('js.app.dir'), '/') . '/';
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
             $sHash = $this->generateHash();
341 341
             $sOutFile = $sHash . '.js';
342 342
             $sMinFile = $sHash . '.min.js';
343
-            if(!is_file($sJsAppDir . $sOutFile))
343
+            if (!is_file($sJsAppDir . $sOutFile))
344 344
             {
345 345
                 file_put_contents($sJsAppDir . $sOutFile, $this->_getScript());
346 346
             }
347
-            if(($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
347
+            if (($this->getOption('js.app.minify')) && !is_file($sJsAppDir . $sMinFile))
348 348
             {
349
-                if(($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
349
+                if (($this->minify($sJsAppDir . $sOutFile, $sJsAppDir . $sMinFile)))
350 350
                 {
351 351
                     $sOutFile = $sMinFile;
352 352
                 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -357,8 +357,7 @@
 block discarded – undo
357 357
                 'sJsOptions' => $this->getOption('js.app.options'),
358 358
                 'sUrl' => $sJsAppURI . $sOutFile,
359 359
             ));
360
-        }
361
-        else
360
+        } else
362 361
         {
363 362
             // The plugins scripts are wrapped with javascript tags
364 363
             $sScript = $this->render('jaxon::plugins/wrapper.js', array(
Please login to merge, or discard this patch.
src/DI/Container.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
     /**
304 304
      * Create a new the config manager
305 305
      *
306
-     * @return Jaxon\Config\Config            The config manager
306
+     * @return Config            The config manager
307 307
      */
308 308
     public function newConfig()
309 309
     {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
     /**
374 374
      * Set the pagination renderer
375 375
      *
376
-     * @param Jaxon\Utils\Pagination\Renderer  $xRenderer    The pagination renderer
376
+     * @param PaginationRenderer  $xRenderer    The pagination renderer
377 377
      *
378 378
      * @return void
379 379
      */
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     /**
406 406
      * Create a new Jaxon response object
407 407
      *
408
-     * @return Jaxon\Response\Response
408
+     * @return Response
409 409
      */
410 410
     public function newResponse()
411 411
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,6 @@
 block discarded – undo
16 16
 
17 17
 use Lemon\Event\EventDispatcher;
18 18
 use Jaxon\Sentry\View\Renderer;
19
-
20 19
 use Jaxon\Jaxon;
21 20
 use Jaxon\Response\Response;
22 21
 use Jaxon\Config\Config;
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public static function getInstance()
51 51
     {
52
-        if(!self::$xInstance)
52
+        if (!self::$xInstance)
53 53
         {
54 54
             self::$xInstance = new Container();
55 55
         }
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
          * Core library objects
110 110
          */
111 111
         // Jaxon Core
112
-        $this->coreContainer[Jaxon::class] = function ($c) {
112
+        $this->coreContainer[Jaxon::class] = function($c) {
113 113
             return new Jaxon();
114 114
         };
115 115
         // Global Response
116
-        $this->coreContainer[Response::class] = function ($c) {
116
+        $this->coreContainer[Response::class] = function($c) {
117 117
             return new Response();
118 118
         };
119 119
         // Dialog
120
-        $this->coreContainer[Dialog::class] = function ($c) {
120
+        $this->coreContainer[Dialog::class] = function($c) {
121 121
             return new Dialog();
122 122
         };
123 123
 
@@ -125,41 +125,41 @@  discard block
 block discarded – undo
125 125
          * Managers
126 126
          */
127 127
         // Callable objects repository
128
-        $this->coreContainer[CallableRepository::class] = function ($c) {
128
+        $this->coreContainer[CallableRepository::class] = function($c) {
129 129
             return new CallableRepository();
130 130
         };
131 131
         // Plugin Manager
132
-        $this->coreContainer[PluginManager::class] = function ($c) {
132
+        $this->coreContainer[PluginManager::class] = function($c) {
133 133
             return new PluginManager();
134 134
         };
135 135
         // Request Manager
136
-        $this->coreContainer[RequestHandler::class] = function ($c) {
136
+        $this->coreContainer[RequestHandler::class] = function($c) {
137 137
             return new RequestHandler($c[PluginManager::class]);
138 138
         };
139 139
         // Request Factory
140
-        $this->coreContainer[RequestFactory::class] = function ($c) {
140
+        $this->coreContainer[RequestFactory::class] = function($c) {
141 141
             return new RequestFactory($c[CallableRepository::class]);
142 142
         };
143 143
         // Parameter Factory
144
-        $this->coreContainer[ParameterFactory::class] = function ($c) {
144
+        $this->coreContainer[ParameterFactory::class] = function($c) {
145 145
             return new ParameterFactory();
146 146
         };
147 147
         // Response Manager
148
-        $this->coreContainer[ResponseManager::class] = function ($c) {
148
+        $this->coreContainer[ResponseManager::class] = function($c) {
149 149
             return new ResponseManager();
150 150
         };
151 151
         // Code Generator
152
-        $this->coreContainer[CodeGenerator::class] = function ($c) {
152
+        $this->coreContainer[CodeGenerator::class] = function($c) {
153 153
             return new CodeGenerator($c[PluginManager::class]);
154 154
         };
155 155
 
156 156
         /*
157 157
          * Config
158 158
          */
159
-        $this->coreContainer[Config::class] = function ($c) {
159
+        $this->coreContainer[Config::class] = function($c) {
160 160
             return new Config();
161 161
         };
162
-        $this->coreContainer[ConfigReader::class] = function ($c) {
162
+        $this->coreContainer[ConfigReader::class] = function($c) {
163 163
             return new ConfigReader();
164 164
         };
165 165
 
@@ -167,31 +167,31 @@  discard block
 block discarded – undo
167 167
          * Services
168 168
          */
169 169
         // Minifier
170
-        $this->coreContainer[Minifier::class] = function ($c) {
170
+        $this->coreContainer[Minifier::class] = function($c) {
171 171
             return new Minifier();
172 172
         };
173 173
         // Translator
174
-        $this->coreContainer[Translator::class] = function ($c) {
174
+        $this->coreContainer[Translator::class] = function($c) {
175 175
             return new Translator($c['jaxon.core.translation_dir'], $c[Config::class]);
176 176
         };
177 177
         // Template engine
178
-        $this->coreContainer[Template::class] = function ($c) {
178
+        $this->coreContainer[Template::class] = function($c) {
179 179
             return new Template($c['jaxon.core.template_dir']);
180 180
         };
181 181
         // Validator
182
-        $this->coreContainer[Validator::class] = function ($c) {
182
+        $this->coreContainer[Validator::class] = function($c) {
183 183
             return new Validator($c[Translator::class], $c[Config::class]);
184 184
         };
185 185
         // Pagination Renderer
186
-        $this->coreContainer[PaginationRenderer::class] = function ($c) {
186
+        $this->coreContainer[PaginationRenderer::class] = function($c) {
187 187
             return new PaginationRenderer($c[Template::class]);
188 188
         };
189 189
         // Pagination Paginator
190
-        $this->coreContainer[Paginator::class] = function ($c) {
190
+        $this->coreContainer[Paginator::class] = function($c) {
191 191
             return new Paginator($c[PaginationRenderer::class]);
192 192
         };
193 193
         // Event Dispatcher
194
-        $this->coreContainer[EventDispatcher::class] = function ($c) {
194
+        $this->coreContainer[EventDispatcher::class] = function($c) {
195 195
             return new EventDispatcher();
196 196
         };
197 197
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function get($sClass)
212 212
     {
213
-        if($this->sentryContainer != null && $this->sentryContainer->has($sClass))
213
+        if ($this->sentryContainer != null && $this->sentryContainer->has($sClass))
214 214
         {
215 215
             return $this->sentryContainer->get($sClass);
216 216
         }
@@ -515,14 +515,14 @@  discard block
 block discarded – undo
515 515
         $this->coreContainer['jaxon.sentry.view.base.' . $sId] = $xClosure;
516 516
 
517 517
         // Return the initialized view renderer
518
-        $this->coreContainer['jaxon.sentry.view.' . $sId] = function ($c) use ($sId) {
518
+        $this->coreContainer['jaxon.sentry.view.' . $sId] = function($c) use ($sId) {
519 519
             // Get the defined renderer
520 520
             $renderer = $c['jaxon.sentry.view.base.' . $sId];
521 521
             // Init the renderer with the template namespaces
522 522
             $aNamespaces = $this->coreContainer['jaxon.view.data.namespaces'];
523
-            if(key_exists($sId, $aNamespaces))
523
+            if (key_exists($sId, $aNamespaces))
524 524
             {
525
-                foreach($aNamespaces[$sId] as $ns)
525
+                foreach ($aNamespaces[$sId] as $ns)
526 526
                 {
527 527
                     $renderer->addNamespace($ns['namespace'], $ns['directory'], $ns['extension']);
528 528
                 }
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
      */
541 541
     public function getViewRenderer($sId = '')
542 542
     {
543
-        if(!$sId)
543
+        if (!$sId)
544 544
         {
545 545
             // Return the view renderer facade
546 546
             return $this->coreContainer[\Jaxon\Sentry\View\Facade::class];
Please login to merge, or discard this patch.
src/Dialog/Dialog.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     /**
63 63
      * Set the javascript confirm function
64 64
      *
65
-     * @param Jaxon\Dialog\Interfaces\Confirm         $xConfirm     The javascript confirm function
65
+     * @param Interfaces\Confirm         $xConfirm     The javascript confirm function
66 66
      *
67 67
      * @return void
68 68
      */
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     /**
105 105
      * Set the javascript alert function
106 106
      *
107
-     * @param Jaxon\Dialog\Interfaces\Alert           $xAlert       The javascript alert function
107
+     * @param Interfaces\Alert           $xAlert       The javascript alert function
108 108
      *
109 109
      * @return void
110 110
      */
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,6 @@
 block discarded – undo
12 12
 namespace Jaxon\Dialog;
13 13
 
14 14
 use Jaxon\Jaxon;
15
-use Jaxon\Plugin\Package;
16
-use Jaxon\Config\Config;
17 15
 
18 16
 class Dialog
19 17
 {
Please login to merge, or discard this patch.
src/Plugin/Manager.php 3 patches
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -22,9 +22,7 @@
 block discarded – undo
22 22
 namespace Jaxon\Plugin;
23 23
 
24 24
 use Jaxon\Jaxon;
25
-use Jaxon\Plugin\Package;
26 25
 use Jaxon\Config\Config;
27
-
28 26
 use Closure;
29 27
 
30 28
 class Manager
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -132,32 +132,32 @@  discard block
 block discarded – undo
132 132
     {
133 133
         $bIsAlert = ($xPlugin instanceof Dialogs\Interfaces\Alert);
134 134
         $bIsConfirm = ($xPlugin instanceof Dialogs\Interfaces\Confirm);
135
-        if($xPlugin instanceof Request)
135
+        if ($xPlugin instanceof Request)
136 136
         {
137 137
             // The name of a request plugin is used as key in the plugin table
138 138
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
139 139
         }
140
-        elseif($xPlugin instanceof Response)
140
+        elseif ($xPlugin instanceof Response)
141 141
         {
142 142
             // The name of a response plugin is used as key in the plugin table
143 143
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
144 144
         }
145
-        elseif(!$bIsConfirm && !$bIsAlert)
145
+        elseif (!$bIsConfirm && !$bIsAlert)
146 146
         {
147 147
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin))));
148 148
         }
149 149
         // This plugin implements the Alert interface
150
-        if($bIsAlert)
150
+        if ($bIsAlert)
151 151
         {
152 152
             $this->setAlert($xPlugin);
153 153
         }
154 154
         // This plugin implements the Confirm interface
155
-        if($bIsConfirm)
155
+        if ($bIsConfirm)
156 156
         {
157 157
             $this->setConfirm($xPlugin);
158 158
         }
159 159
         // Register the plugin as an event listener
160
-        if($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
160
+        if ($xPlugin instanceof \Jaxon\Utils\Interfaces\EventListener)
161 161
         {
162 162
             $this->addEventListener($xPlugin);
163 163
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function register($sType, $sCallable, $aOptions = [])
194 194
     {
195
-        if(!key_exists($sType, $this->aRequestPlugins))
195
+        if (!key_exists($sType, $this->aRequestPlugins))
196 196
         {
197 197
             throw new \Jaxon\Exception\Error($this->trans('errors.register.plugin', ['name' => $sType]));
198 198
         }
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
     {
221 221
         // Register user functions
222 222
         $aFunctionsConfig = $xAppConfig->getOption('functions', []);
223
-        foreach($aFunctionsConfig as $xKey => $xValue)
223
+        foreach ($aFunctionsConfig as $xKey => $xValue)
224 224
         {
225
-            if(is_integer($xKey) && is_string($xValue))
225
+            if (is_integer($xKey) && is_string($xValue))
226 226
             {
227 227
                 $sFunction = $xValue;
228 228
                 // Register a function without options
229 229
                 $this->register(Jaxon::USER_FUNCTION, $sFunction);
230 230
             }
231
-            elseif(is_string($xKey) && is_array($xValue))
231
+            elseif (is_string($xKey) && is_array($xValue))
232 232
             {
233 233
                 $sFunction = $xKey;
234 234
                 $aOptions = $xValue;
@@ -244,25 +244,25 @@  discard block
 block discarded – undo
244 244
 
245 245
         // Register classes and directories
246 246
         $aClassesConfig = $xAppConfig->getOption('classes', []);
247
-        foreach($aClassesConfig as $xKey => $xValue)
247
+        foreach ($aClassesConfig as $xKey => $xValue)
248 248
         {
249
-            if(is_integer($xKey) && is_string($xValue))
249
+            if (is_integer($xKey) && is_string($xValue))
250 250
             {
251 251
                 $sClass = $xValue;
252 252
                 // Register a class without options
253 253
                 $this->register(Jaxon::CALLABLE_CLASS, $sClass);
254 254
             }
255
-            elseif(is_string($xKey) && is_array($xValue))
255
+            elseif (is_string($xKey) && is_array($xValue))
256 256
             {
257 257
                 $sClass = $xKey;
258 258
                 $aOptions = $xValue;
259 259
                 // Register a class with options
260 260
                 $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions);
261 261
             }
262
-            elseif(is_integer($xKey) && is_array($xValue))
262
+            elseif (is_integer($xKey) && is_array($xValue))
263 263
             {
264 264
                 // The directory path is required
265
-                if(!key_exists('directory', $xValue))
265
+                if (!key_exists('directory', $xValue))
266 266
                 {
267 267
                     continue;
268 268
                     // Todo: throw an exception
@@ -270,17 +270,17 @@  discard block
 block discarded – undo
270 270
                 // Registering a directory
271 271
                 $sDirectory = $xValue['directory'];
272 272
                 $aOptions = [];
273
-                if(key_exists('options', $xValue) &&
273
+                if (key_exists('options', $xValue) &&
274 274
                     is_array($xValue['options']) || is_string($xValue['options']))
275 275
                 {
276 276
                     $aOptions = $xValue['options'];
277 277
                 }
278 278
                 // Setup directory options
279
-                if(key_exists('namespace', $xValue))
279
+                if (key_exists('namespace', $xValue))
280 280
                 {
281 281
                     $aOptions['namespace'] = $xValue['namespace'];
282 282
                 }
283
-                if(key_exists('separator', $xValue))
283
+                if (key_exists('separator', $xValue))
284 284
                 {
285 285
                     $aOptions['separator'] = $xValue['separator'];
286 286
                 }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      */
306 306
     public function getResponsePlugin($sName)
307 307
     {
308
-        if(array_key_exists($sName, $this->aResponsePlugins))
308
+        if (array_key_exists($sName, $this->aResponsePlugins))
309 309
         {
310 310
             return $this->aResponsePlugins[$sName];
311 311
         }
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
      */
322 322
     public function getRequestPlugin($sName)
323 323
     {
324
-        if(array_key_exists($sName, $this->aRequestPlugins))
324
+        if (array_key_exists($sName, $this->aRequestPlugins))
325 325
         {
326 326
             return $this->aRequestPlugins[$sName];
327 327
         }
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -136,13 +136,11 @@  discard block
 block discarded – undo
136 136
         {
137 137
             // The name of a request plugin is used as key in the plugin table
138 138
             $this->aRequestPlugins[$xPlugin->getName()] = $xPlugin;
139
-        }
140
-        elseif($xPlugin instanceof Response)
139
+        } elseif($xPlugin instanceof Response)
141 140
         {
142 141
             // The name of a response plugin is used as key in the plugin table
143 142
             $this->aResponsePlugins[$xPlugin->getName()] = $xPlugin;
144
-        }
145
-        elseif(!$bIsConfirm && !$bIsAlert)
143
+        } elseif(!$bIsConfirm && !$bIsAlert)
146 144
         {
147 145
             throw new \Jaxon\Exception\Error($this->trans('errors.register.invalid', array('name' => get_class($xPlugin))));
148 146
         }
@@ -227,15 +225,13 @@  discard block
 block discarded – undo
227 225
                 $sFunction = $xValue;
228 226
                 // Register a function without options
229 227
                 $this->register(Jaxon::USER_FUNCTION, $sFunction);
230
-            }
231
-            elseif(is_string($xKey) && is_array($xValue))
228
+            } elseif(is_string($xKey) && is_array($xValue))
232 229
             {
233 230
                 $sFunction = $xKey;
234 231
                 $aOptions = $xValue;
235 232
                 // Register a function with options
236 233
                 $this->register(Jaxon::USER_FUNCTION, $sFunction, $aOptions);
237
-            }
238
-            else
234
+            } else
239 235
             {
240 236
                 continue;
241 237
                 // Todo: throw an exception
@@ -251,15 +247,13 @@  discard block
 block discarded – undo
251 247
                 $sClass = $xValue;
252 248
                 // Register a class without options
253 249
                 $this->register(Jaxon::CALLABLE_CLASS, $sClass);
254
-            }
255
-            elseif(is_string($xKey) && is_array($xValue))
250
+            } elseif(is_string($xKey) && is_array($xValue))
256 251
             {
257 252
                 $sClass = $xKey;
258 253
                 $aOptions = $xValue;
259 254
                 // Register a class with options
260 255
                 $this->register(Jaxon::CALLABLE_CLASS, $sClass, $aOptions);
261
-            }
262
-            elseif(is_integer($xKey) && is_array($xValue))
256
+            } elseif(is_integer($xKey) && is_array($xValue))
263 257
             {
264 258
                 // The directory path is required
265 259
                 if(!key_exists('directory', $xValue))
@@ -286,8 +280,7 @@  discard block
 block discarded – undo
286 280
                 }
287 281
                 // Register a class without options
288 282
                 $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions);
289
-            }
290
-            else
283
+            } else
291 284
             {
292 285
                 continue;
293 286
                 // Todo: throw an exception
Please login to merge, or discard this patch.
src/Jaxon.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
             'core.prefix.class'                 => 'Jaxon',
157 157
             // 'core.request.uri'               => '',
158 158
             'core.request.mode'                 => 'asynchronous',
159
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
159
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
160 160
             'core.response.merge.ap'            => true,
161 161
             'core.response.merge.js'            => true,
162 162
             'core.debug.on'                     => false,
@@ -244,17 +244,17 @@  discard block
 block discarded – undo
244 244
      */
245 245
     public function getScript($bIncludeJs = false, $bIncludeCss = false)
246 246
     {
247
-        if(!$this->getOption('core.request.uri'))
247
+        if (!$this->getOption('core.request.uri'))
248 248
         {
249 249
             $this->setOption('core.request.uri', URI::detect());
250 250
         }
251 251
         $sCode = '';
252 252
         $xCodeGenerator = $this->di()->getCodeGenerator();
253
-        if(($bIncludeCss))
253
+        if (($bIncludeCss))
254 254
         {
255 255
             $sCode .= $xCodeGenerator->getCss() . "\n";
256 256
         }
257
-        if(($bIncludeJs))
257
+        if (($bIncludeJs))
258 258
         {
259 259
             $sCode .= $xCodeGenerator->getJs() . "\n";
260 260
         }
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
     public function processRequest()
326 326
     {
327 327
         // Check to see if headers have already been sent out, in which case we can't do our job
328
-        if(headers_sent($filename, $linenumber))
328
+        if (headers_sent($filename, $linenumber))
329 329
         {
330 330
             echo $this->trans('errors.output.already-sent', array(
331 331
                 'location' => $filename . ':' . $linenumber
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
         }
335 335
 
336 336
         // Check if there is a plugin to process this request
337
-        if(!$this->canProcessRequest())
337
+        if (!$this->canProcessRequest())
338 338
         {
339 339
             return;
340 340
         }
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
         $xResponseManager = $this->getResponseManager();
345 345
 
346 346
         // Handle before processing event
347
-        if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
347
+        if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]))
348 348
         {
349 349
             $this->aProcessingEvents[self::PROCESSING_EVENT_BEFORE]->call(array(&$bEndRequest));
350 350
         }
351 351
 
352
-        if(!$bEndRequest)
352
+        if (!$bEndRequest)
353 353
         {
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357 357
             }
358
-            catch(Exception $e)
358
+            catch (Exception $e)
359 359
             {
360 360
                 // An exception was thrown while processing the request.
361 361
                 // The request missed the corresponding handler function,
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
                 $xResponseManager->debug($e->getMessage());
368 368
                 $mResult = false;
369 369
 
370
-                if($e instanceof \Jaxon\Exception\Error)
370
+                if ($e instanceof \Jaxon\Exception\Error)
371 371
                 {
372 372
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 373
                     $aParams = array($e->getMessage());
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
                     $aParams = array($e);
379 379
                 }
380 380
 
381
-                if(isset($this->aProcessingEvents[$sEvent]))
381
+                if (isset($this->aProcessingEvents[$sEvent]))
382 382
                 {
383 383
                     // Call the processing event
384 384
                     $this->aProcessingEvents[$sEvent]->call($aParams);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
             }
392 392
         }
393 393
         // Clean the processing buffer
394
-        if(($this->getOption('core.process.clean')))
394
+        if (($this->getOption('core.process.clean')))
395 395
         {
396 396
             $er = error_reporting(0);
397 397
             while (ob_get_level() > 0)
@@ -401,16 +401,16 @@  discard block
 block discarded – undo
401 401
             error_reporting($er);
402 402
         }
403 403
 
404
-        if($mResult === true)
404
+        if ($mResult === true)
405 405
         {
406 406
             // Handle after processing event
407
-            if(isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
407
+            if (isset($this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]))
408 408
             {
409 409
                 $bEndRequest = false;
410 410
                 $this->aProcessingEvents[self::PROCESSING_EVENT_AFTER]->call(array($bEndRequest));
411 411
             }
412 412
             // If the called function returned no response, give the the global response instead
413
-            if($xResponseManager->hasNoResponse())
413
+            if ($xResponseManager->hasNoResponse())
414 414
             {
415 415
                 $xResponseManager->append($this->getResponse());
416 416
             }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 
419 419
         $xResponseManager->printDebug();
420 420
 
421
-        if(($this->getOption('core.process.exit')))
421
+        if (($this->getOption('core.process.exit')))
422 422
         {
423 423
             $xResponseManager->sendOutput();
424 424
             exit();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -354,8 +354,7 @@  discard block
 block discarded – undo
354 354
             try
355 355
             {
356 356
                 $mResult = $this->getRequestHandler()->processRequest();
357
-            }
358
-            catch(Exception $e)
357
+            } catch(Exception $e)
359 358
             {
360 359
                 // An exception was thrown while processing the request.
361 360
                 // The request missed the corresponding handler function,
@@ -371,8 +370,7 @@  discard block
 block discarded – undo
371 370
                 {
372 371
                     $sEvent = self::PROCESSING_EVENT_INVALID;
373 372
                     $aParams = array($e->getMessage());
374
-                }
375
-                else
373
+                } else
376 374
                 {
377 375
                     $sEvent = self::PROCESSING_EVENT_ERROR;
378 376
                     $aParams = array($e);
@@ -382,8 +380,7 @@  discard block
 block discarded – undo
382 380
                 {
383 381
                     // Call the processing event
384 382
                     $this->aProcessingEvents[$sEvent]->call($aParams);
385
-                }
386
-                else
383
+                } else
387 384
                 {
388 385
                     // The exception is not to be processed here.
389 386
                     throw $e;
Please login to merge, or discard this patch.
src/Response/Response.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function plugin($sName)
102 102
     {
103 103
         $xPlugin = $this->getPluginManager()->getResponsePlugin($sName);
104
-        if(!$xPlugin)
104
+        if (!$xPlugin)
105 105
         {
106 106
             return null;
107 107
         }
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
     public function addCommand($aAttributes, $mData)
165 165
     {
166 166
         /* merge commands if possible */
167
-        if(in_array($aAttributes['cmd'], array('js', 'ap')))
167
+        if (in_array($aAttributes['cmd'], array('js', 'ap')))
168 168
         {
169
-            if(($aLastCommand = array_pop($this->aCommands)))
169
+            if (($aLastCommand = array_pop($this->aCommands)))
170 170
             {
171
-                if($aLastCommand['cmd'] == $aAttributes['cmd'])
171
+                if ($aLastCommand['cmd'] == $aAttributes['cmd'])
172 172
                 {
173
-                    if($this->getOption('core.response.merge.js') &&
173
+                    if ($this->getOption('core.response.merge.js') &&
174 174
                             $aLastCommand['cmd'] == 'js')
175 175
                     {
176
-                        $mData = $aLastCommand['data'].'; '.$mData;
176
+                        $mData = $aLastCommand['data'] . '; ' . $mData;
177 177
                     }
178
-                    elseif($this->getOption('core.response.merge.ap') &&
178
+                    elseif ($this->getOption('core.response.merge.ap') &&
179 179
                             $aLastCommand['cmd'] == 'ap' &&
180 180
                             $aLastCommand['id'] == $aAttributes['id'] &&
181 181
                             $aLastCommand['prop'] == $aAttributes['prop'])
182 182
                     {
183
-                        $mData = $aLastCommand['data'].' '.$mData;
183
+                        $mData = $aLastCommand['data'] . ' ' . $mData;
184 184
                     }
185 185
                     else
186 186
                     {
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
      */
238 238
     public function appendResponse($mCommands, $bBefore = false)
239 239
     {
240
-        if($mCommands instanceof Response)
240
+        if ($mCommands instanceof Response)
241 241
         {
242 242
             $this->returnValue = $mCommands->returnValue;
243 243
 
244
-            if($bBefore)
244
+            if ($bBefore)
245 245
             {
246 246
                 $this->aCommands = array_merge($mCommands->aCommands, $this->aCommands);
247 247
             }
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
                 $this->aCommands = array_merge($this->aCommands, $mCommands->aCommands);
251 251
             }
252 252
         }
253
-        elseif(is_array($mCommands))
253
+        elseif (is_array($mCommands))
254 254
         {
255
-            if($bBefore)
255
+            if ($bBefore)
256 256
             {
257 257
                 $this->aCommands = array_merge($mCommands, $this->aCommands);
258 258
             }
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         }
264 264
         else
265 265
         {
266
-            if(!empty($mCommands))
266
+            if (!empty($mCommands))
267 267
             {
268 268
                 throw new \Jaxon\Exception\Error($this->trans('errors.response.data.invalid'));
269 269
             }
@@ -531,33 +531,33 @@  discard block
 block discarded – undo
531 531
      *
532 532
      * @return \Jaxon\Plugin\Response
533 533
      */
534
-    public function redirect($sURL, $iDelay=0)
534
+    public function redirect($sURL, $iDelay = 0)
535 535
     {
536 536
         // we need to parse the query part so that the values are rawurlencode()'ed
537 537
         // can't just use parse_url() cos we could be dealing with a relative URL which
538 538
         // parse_url() can't deal with.
539 539
         $queryStart = strpos($sURL, '?', strrpos($sURL, '/'));
540
-        if($queryStart !== false)
540
+        if ($queryStart !== false)
541 541
         {
542 542
             $queryStart++;
543 543
             $queryEnd = strpos($sURL, '#', $queryStart);
544
-            if($queryEnd === false)
544
+            if ($queryEnd === false)
545 545
                 $queryEnd = strlen($sURL);
546
-            $queryPart = substr($sURL, $queryStart, $queryEnd-$queryStart);
546
+            $queryPart = substr($sURL, $queryStart, $queryEnd - $queryStart);
547 547
             parse_str($queryPart, $queryParts);
548 548
             $newQueryPart = "";
549
-            if($queryParts)
549
+            if ($queryParts)
550 550
             {
551 551
                 $first = true;
552
-                foreach($queryParts as $key => $value)
552
+                foreach ($queryParts as $key => $value)
553 553
                 {
554
-                    if($first)
554
+                    if ($first)
555 555
                         $first = false;
556 556
                     else
557 557
                         $newQueryPart .= '&';
558
-                    $newQueryPart .= rawurlencode($key).'='.rawurlencode($value);
558
+                    $newQueryPart .= rawurlencode($key) . '=' . rawurlencode($value);
559 559
                 }
560
-            } elseif($_SERVER['QUERY_STRING']) {
560
+            } elseif ($_SERVER['QUERY_STRING']) {
561 561
                     //couldn't break up the query, but there's one there
562 562
                     //possibly "http://url/page.html?query1234" type of query?
563 563
                     //just encode it and hope it works
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
                 }
566 566
             $sURL = str_replace($queryPart, $newQueryPart, $sURL);
567 567
         }
568
-        if($iDelay)
569
-            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay*1000) . ');');
568
+        if ($iDelay)
569
+            $this->script('window.setTimeout("window.location = \'' . $sURL . '\';",' . ($iDelay * 1000) . ');');
570 570
         else
571 571
             $this->script('window.location = "' . $sURL . '";');
572 572
         return $this;
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
     {
904 904
         $command = array('cmd'  =>  'in');
905 905
 
906
-        if(($sType))
906
+        if (($sType))
907 907
             $command['type'] = trim((string)$sType, " \t");
908 908
 
909
-        if(($sId))
909
+        if (($sId))
910 910
             $command['elm_id'] = trim((string)$sId, " \t");
911 911
 
912 912
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -924,10 +924,10 @@  discard block
 block discarded – undo
924 924
     {
925 925
         $command = array('cmd' => 'ino');
926 926
 
927
-        if(($sType))
927
+        if (($sType))
928 928
             $command['type'] = trim((string)$sType, " \t");
929 929
 
930
-        if(($sId))
930
+        if (($sId))
931 931
             $command['elm_id'] = trim((string)$sId, " \t");
932 932
 
933 933
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
     {
969 969
         $command = array('cmd' => 'css');
970 970
 
971
-        if(($sMedia))
971
+        if (($sMedia))
972 972
             $command['media'] = trim((string)$sMedia, " \t");
973 973
 
974 974
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     {
988 988
         $command = array('cmd' => 'rcss');
989 989
 
990
-        if(($sMedia))
990
+        if (($sMedia))
991 991
             $command['media'] = trim((string)$sMedia, " \t");
992 992
 
993 993
         return $this->addCommand($command, trim((string)$sFileName, " \t"));
@@ -1128,10 +1128,10 @@  discard block
 block discarded – undo
1128 1128
     {
1129 1129
         $command = array('cmd' => 'DRC');
1130 1130
 
1131
-        if(($skip))
1131
+        if (($skip))
1132 1132
             $command['skip'] = $skip;
1133 1133
 
1134
-        if(($remove))
1134
+        if (($remove))
1135 1135
             $command['remove'] = $remove;
1136 1136
 
1137 1137
         return $this->addCommand($command, $parent);
@@ -1256,7 +1256,7 @@  discard block
 block discarded – undo
1256 1256
      */
1257 1257
     public function sendHeaders()
1258 1258
     {
1259
-        if($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET)
1259
+        if ($this->getRequesthandler()->getRequestMethod() == Jaxon::METHOD_GET)
1260 1260
         {
1261 1261
             header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
1262 1262
             header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
 
1267 1267
         $sCharacterSet = '';
1268 1268
         $sCharacterEncoding = trim($this->getOption('core.encoding'));
1269
-        if(($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1269
+        if (($sCharacterEncoding) && strlen($sCharacterEncoding) > 0)
1270 1270
         {
1271 1271
             $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
1272 1272
         }
@@ -1283,13 +1283,13 @@  discard block
 block discarded – undo
1283 1283
     {
1284 1284
         $response = [];
1285 1285
 
1286
-        if(($this->returnValue))
1286
+        if (($this->returnValue))
1287 1287
         {
1288 1288
             $response['jxnrv'] = $this->returnValue;
1289 1289
         }
1290 1290
         $response['jxnobj'] = [];
1291 1291
 
1292
-        foreach($this->aCommands as $xCommand)
1292
+        foreach ($this->aCommands as $xCommand)
1293 1293
         {
1294 1294
             $response['jxnobj'][] = $xCommand;
1295 1295
         }
Please login to merge, or discard this patch.
src/Request/Handler.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -63,17 +63,17 @@  discard block
 block discarded – undo
63 63
         $this->aArgs = [];
64 64
         $this->nMethod = Jaxon::METHOD_UNKNOWN;
65 65
 
66
-        if(isset($_POST['jxnargs']))
66
+        if (isset($_POST['jxnargs']))
67 67
         {
68 68
             $this->nMethod = Jaxon::METHOD_POST;
69 69
             $this->aArgs = $_POST['jxnargs'];
70 70
         }
71
-        elseif(isset($_GET['jxnargs']))
71
+        elseif (isset($_GET['jxnargs']))
72 72
         {
73 73
             $this->nMethod = Jaxon::METHOD_GET;
74 74
             $this->aArgs = $_GET['jxnargs'];
75 75
         }
76
-        if(get_magic_quotes_gpc() == 1)
76
+        if (get_magic_quotes_gpc() == 1)
77 77
         {
78 78
             array_walk($this->aArgs, array(&$this, '__argumentStripSlashes'));
79 79
         }
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
      */
90 90
     private function __convertStringToBool($sValue)
91 91
     {
92
-        if(strcasecmp($sValue, 'true') == 0)
92
+        if (strcasecmp($sValue, 'true') == 0)
93 93
         {
94 94
             return true;
95 95
         }
96
-        if(strcasecmp($sValue, 'false') == 0)
96
+        if (strcasecmp($sValue, 'false') == 0)
97 97
         {
98 98
             return false;
99 99
         }
100
-        if(is_numeric($sValue))
100
+        if (is_numeric($sValue))
101 101
         {
102
-            if($sValue == 0)
102
+            if ($sValue == 0)
103 103
             {
104 104
                 return false;
105 105
             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     private function __argumentStripSlashes(&$sArg)
119 119
     {
120
-        if(!is_string($sArg))
120
+        if (!is_string($sArg))
121 121
         {
122 122
             return '';
123 123
         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
      */
166 166
     private function __argumentDecode(&$sArg)
167 167
     {
168
-        if($sArg == '')
168
+        if ($sArg == '')
169 169
         {
170 170
             return '';
171 171
         }
@@ -174,22 +174,22 @@  discard block
 block discarded – undo
174 174
         $sType = 'multipart/form-data';
175 175
         $iLen = strlen($sType);
176 176
         $sContentType = '';
177
-        if(key_exists('CONTENT_TYPE', $_SERVER))
177
+        if (key_exists('CONTENT_TYPE', $_SERVER))
178 178
         {
179 179
             $sContentType = substr($_SERVER['CONTENT_TYPE'], 0, $iLen);
180 180
         }
181
-        elseif(key_exists('HTTP_CONTENT_TYPE', $_SERVER))
181
+        elseif (key_exists('HTTP_CONTENT_TYPE', $_SERVER))
182 182
         {
183 183
             $sContentType = substr($_SERVER['HTTP_CONTENT_TYPE'], 0, $iLen);
184 184
         }
185
-        if($sContentType == $sType)
185
+        if ($sContentType == $sType)
186 186
         {
187 187
             $sArg = urldecode($sArg);
188 188
         }
189 189
 
190 190
         $data = json_decode($sArg, true);
191 191
 
192
-        if($data !== null && $sArg != $data)
192
+        if ($data !== null && $sArg != $data)
193 193
         {
194 194
             $sArg = $data;
195 195
         }
@@ -208,13 +208,13 @@  discard block
 block discarded – undo
208 208
      */
209 209
     private function __argumentDecodeUTF8_iconv(&$mArg)
210 210
     {
211
-        if(is_array($mArg))
211
+        if (is_array($mArg))
212 212
         {
213
-            foreach($mArg as $sKey => &$xArg)
213
+            foreach ($mArg as $sKey => &$xArg)
214 214
             {
215 215
                 $sNewKey = $sKey;
216 216
                 $this->__argumentDecodeUTF8_iconv($sNewKey);
217
-                if($sNewKey != $sKey)
217
+                if ($sNewKey != $sKey)
218 218
                 {
219 219
                     $mArg[$sNewKey] = $xArg;
220 220
                     unset($mArg[$sKey]);
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                 $this->__argumentDecodeUTF8_iconv($xArg);
224 224
             }
225 225
         }
226
-        elseif(is_string($mArg))
226
+        elseif (is_string($mArg))
227 227
         {
228 228
             $mArg = iconv("UTF-8", $this->getOption('core.encoding') . '//TRANSLIT', $mArg);
229 229
         }
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
      */
239 239
     private function __argumentDecodeUTF8_mb_convert_encoding(&$mArg)
240 240
     {
241
-        if(is_array($mArg))
241
+        if (is_array($mArg))
242 242
         {
243
-            foreach($mArg as $sKey => &$xArg)
243
+            foreach ($mArg as $sKey => &$xArg)
244 244
             {
245 245
                 $sNewKey = $sKey;
246 246
                 $this->__argumentDecodeUTF8_mb_convert_encoding($sNewKey);
247
-                if($sNewKey != $sKey)
247
+                if ($sNewKey != $sKey)
248 248
                 {
249 249
                     $mArg[$sNewKey] = $xArg;
250 250
                     unset($mArg[$sKey]);
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
                 $this->__argumentDecodeUTF8_mb_convert_encoding($xArg);
254 254
             }
255 255
         }
256
-        elseif(is_string($mArg))
256
+        elseif (is_string($mArg))
257 257
         {
258 258
             $mArg = mb_convert_encoding($mArg, $this->getOption('core.encoding'), "UTF-8");
259 259
         }
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
      */
269 269
     private function __argumentDecodeUTF8_utf8_decode(&$mArg)
270 270
     {
271
-        if(is_array($mArg))
271
+        if (is_array($mArg))
272 272
         {
273
-            foreach($mArg as $sKey => &$xArg)
273
+            foreach ($mArg as $sKey => &$xArg)
274 274
             {
275 275
                 $sNewKey = $sKey;
276 276
                 $this->__argumentDecodeUTF8_utf8_decode($sNewKey);
277 277
 
278
-                if($sNewKey != $sKey)
278
+                if ($sNewKey != $sKey)
279 279
                 {
280 280
                     $mArg[$sNewKey] = $xArg;
281 281
                     unset($mArg[$sKey]);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 $this->__argumentDecodeUTF8_utf8_decode($xArg);
286 286
             }
287 287
         }
288
-        elseif(is_string($mArg))
288
+        elseif (is_string($mArg))
289 289
         {
290 290
             $mArg = utf8_decode($mArg);
291 291
         }
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
      */
311 311
     public function processArguments()
312 312
     {
313
-        if(($this->getOption('core.decode_utf8')))
313
+        if (($this->getOption('core.decode_utf8')))
314 314
         {
315 315
             $sFunction = '';
316 316
 
317
-            if(function_exists('iconv'))
317
+            if (function_exists('iconv'))
318 318
             {
319 319
                 $sFunction = "iconv";
320 320
             }
321
-            elseif(function_exists('mb_convert_encoding'))
321
+            elseif (function_exists('mb_convert_encoding'))
322 322
             {
323 323
                 $sFunction = "mb_convert_encoding";
324 324
             }
325
-            elseif($this->getOption('core.encoding') == "ISO-8859-1")
325
+            elseif ($this->getOption('core.encoding') == "ISO-8859-1")
326 326
             {
327 327
                 $sFunction = "utf8_decode";
328 328
             }
@@ -349,9 +349,9 @@  discard block
 block discarded – undo
349 349
      */
350 350
     public function canProcessRequest()
351 351
     {
352
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
352
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
353 353
         {
354
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
354
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
355 355
             {
356 356
                 return true;
357 357
             }
@@ -369,13 +369,13 @@  discard block
 block discarded – undo
369 369
      */
370 370
     public function processRequest()
371 371
     {
372
-        foreach($this->xPluginManager->getRequestPlugins() as $xPlugin)
372
+        foreach ($this->xPluginManager->getRequestPlugins() as $xPlugin)
373 373
         {
374
-            if($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
374
+            if ($xPlugin->getName() != Jaxon::FILE_UPLOAD && $xPlugin->canProcessRequest())
375 375
             {
376 376
                 $xUploadPlugin = $this->xPluginManager->getRequestPlugin(Jaxon::FILE_UPLOAD);
377 377
                 // Process uploaded files
378
-                if($xUploadPlugin != null)
378
+                if ($xUploadPlugin != null)
379 379
                 {
380 380
                     $xUploadPlugin->processRequest();
381 381
                 }
Please login to merge, or discard this patch.
src/Request/Plugin/UserFunction.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 
46 46
     public function __construct()
47 47
     {
48
-        if(isset($_GET['jxnfun']))
48
+        if (isset($_GET['jxnfun']))
49 49
         {
50 50
             $this->sRequestedFunction = $_GET['jxnfun'];
51 51
         }
52
-        if(isset($_POST['jxnfun']))
52
+        if (isset($_POST['jxnfun']))
53 53
         {
54 54
             $this->sRequestedFunction = $_POST['jxnfun'];
55 55
         }
@@ -76,30 +76,30 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function register($sType, $sUserFunction, $aOptions)
78 78
     {
79
-        if($sType != $this->getName())
79
+        if ($sType != $this->getName())
80 80
         {
81 81
             return false;
82 82
         }
83 83
 
84
-        if(!is_string($sUserFunction))
84
+        if (!is_string($sUserFunction))
85 85
         {
86 86
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
87 87
         }
88 88
 
89
-        if(is_string($aOptions))
89
+        if (is_string($aOptions))
90 90
         {
91 91
             $aOptions = ['include' => $aOptions];
92 92
         }
93
-        if(!is_array($aOptions))
93
+        if (!is_array($aOptions))
94 94
         {
95 95
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid-declaration'));
96 96
         }
97 97
 
98 98
         // Check if an alias is defined
99 99
         $sFunctionName = $sUserFunction;
100
-        foreach($aOptions as $sName => $sValue)
100
+        foreach ($aOptions as $sName => $sValue)
101 101
         {
102
-            if($sName == 'alias')
102
+            if ($sName == 'alias')
103 103
             {
104 104
                 $sFunctionName = $sValue;
105 105
                 break;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
         }
108 108
 
109 109
         $this->aFunctions[$sFunctionName] = $aOptions;
110
-        jaxon()->di()->set($sFunctionName, function () use ($sFunctionName, $sUserFunction) {
110
+        jaxon()->di()->set($sFunctionName, function() use ($sFunctionName, $sUserFunction) {
111 111
             $xUserFunction = new \Jaxon\Request\Support\UserFunction($sUserFunction);
112 112
 
113 113
             $aOptions = $this->aFunctions[$sFunctionName];
114
-            foreach($aOptions as $sName => $sValue)
114
+            foreach ($aOptions as $sName => $sValue)
115 115
             {
116 116
                 $xUserFunction->configure($sName, $sValue);
117 117
             }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     {
142 142
         $di = jaxon()->di();
143 143
         $code = '';
144
-        foreach(array_keys($this->aFunctions) as $sName)
144
+        foreach (array_keys($this->aFunctions) as $sName)
145 145
         {
146 146
             $xFunction = $di->get($sName);
147 147
             $code .= $xFunction->getScript();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     public function canProcessRequest()
158 158
     {
159 159
         // Check the validity of the function name
160
-        if(($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
160
+        if (($this->sRequestedFunction) && !$this->validateFunction($this->sRequestedFunction))
161 161
         {
162 162
             $this->sRequestedFunction = null;
163 163
         }
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function processRequest()
173 173
     {
174
-        if(!$this->canProcessRequest())
174
+        if (!$this->canProcessRequest())
175 175
         {
176 176
             return false;
177 177
         }
178 178
 
179 179
         // Security check: make sure the requested function was registered.
180
-        if(!key_exists($this->sRequestedFunction, $this->aFunctions))
180
+        if (!key_exists($this->sRequestedFunction, $this->aFunctions))
181 181
         {
182 182
             // Unable to find the requested function
183 183
             throw new \Jaxon\Exception\Error($this->trans('errors.functions.invalid',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         $jaxon = jaxon();
189 189
         $aArgs = $jaxon->getRequestHandler()->processArguments();
190 190
         $xResponse = $xFunction->call($aArgs);
191
-        if(($xResponse))
191
+        if (($xResponse))
192 192
         {
193 193
             $jaxon->getResponseManager()->append($xResponse);
194 194
         }
Please login to merge, or discard this patch.
src/Request/Plugin/CallableClass.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -60,19 +60,19 @@  discard block
 block discarded – undo
60 60
     {
61 61
         $this->xRepository = $xRepository;
62 62
 
63
-        if(!empty($_GET['jxncls']))
63
+        if (!empty($_GET['jxncls']))
64 64
         {
65 65
             $this->sRequestedClass = $_GET['jxncls'];
66 66
         }
67
-        if(!empty($_GET['jxnmthd']))
67
+        if (!empty($_GET['jxnmthd']))
68 68
         {
69 69
             $this->sRequestedMethod = $_GET['jxnmthd'];
70 70
         }
71
-        if(!empty($_POST['jxncls']))
71
+        if (!empty($_POST['jxncls']))
72 72
         {
73 73
             $this->sRequestedClass = $_POST['jxncls'];
74 74
         }
75
-        if(!empty($_POST['jxnmthd']))
75
+        if (!empty($_POST['jxnmthd']))
76 76
         {
77 77
             $this->sRequestedMethod = $_POST['jxnmthd'];
78 78
         }
@@ -99,20 +99,20 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function register($sType, $sClassName, $aOptions)
101 101
     {
102
-        if($sType != $this->getName())
102
+        if ($sType != $this->getName())
103 103
         {
104 104
             return false;
105 105
         }
106 106
 
107
-        if(!is_string($sClassName))
107
+        if (!is_string($sClassName))
108 108
         {
109 109
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
110 110
         }
111
-        if(is_string($aOptions))
111
+        if (is_string($aOptions))
112 112
         {
113 113
             $aOptions = ['include' => $aOptions];
114 114
         }
115
-        if(!is_array($aOptions))
115
+        if (!is_array($aOptions))
116 116
         {
117 117
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid-declaration'));
118 118
         }
@@ -150,13 +150,13 @@  discard block
 block discarded – undo
150 150
     public function canProcessRequest()
151 151
     {
152 152
         // Check the validity of the class name
153
-        if($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
153
+        if ($this->sRequestedClass !== null && !$this->validateClass($this->sRequestedClass))
154 154
         {
155 155
             $this->sRequestedClass = null;
156 156
             $this->sRequestedMethod = null;
157 157
         }
158 158
         // Check the validity of the method name
159
-        if($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
159
+        if ($this->sRequestedMethod !== null && !$this->validateMethod($this->sRequestedMethod))
160 160
         {
161 161
             $this->sRequestedClass = null;
162 162
             $this->sRequestedMethod = null;
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
      */
172 172
     public function processRequest()
173 173
     {
174
-        if(!$this->canProcessRequest())
174
+        if (!$this->canProcessRequest())
175 175
         {
176 176
             return false;
177 177
         }
178 178
 
179 179
         // Find the requested method
180 180
         $xCallableObject = $this->xRepository->getCallableObject($this->sRequestedClass);
181
-        if(!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
181
+        if (!$xCallableObject || !$xCallableObject->hasMethod($this->sRequestedMethod))
182 182
         {
183 183
             // Unable to find the requested object or method
184 184
             throw new \Jaxon\Exception\Error($this->trans('errors.objects.invalid',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
         $jaxon = jaxon();
190 190
         $aArgs = $jaxon->getRequestHandler()->processArguments();
191 191
         $xResponse = $xCallableObject->call($this->sRequestedMethod, $aArgs);
192
-        if(($xResponse))
192
+        if (($xResponse))
193 193
         {
194 194
             $jaxon->getResponseManager()->append($xResponse);
195 195
         }
Please login to merge, or discard this patch.