Completed
Push — master ( a209a4...fff73d )
by Thierry
02:29
created
src/Factory/Request.php 1 patch
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param string|null            $sClass              The callable class
56 56
      *
57
-     * @return Factory
57
+     * @return Request
58 58
      */
59 59
     public function setClassName($sClass)
60 60
     {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @param CallableObject          $xCallable              The callable object
84 84
      *
85
-     * @return Factory
85
+     * @return Request
86 86
      */
87 87
     public function setCallable(CallableObject $xCallable)
88 88
     {
@@ -95,7 +95,6 @@  discard block
 block discarded – undo
95 95
      * Return the javascript call to a Jaxon function or object method
96 96
      *
97 97
      * @param string            $sFunction          The function or method (without class) name
98
-     * @param ...               $xParams            The parameters of the function or method
99 98
      *
100 99
      * @return \Jaxon\Request\Request
101 100
      */
@@ -124,7 +123,6 @@  discard block
 block discarded – undo
124 123
      * Return the javascript call to a generic function
125 124
      *
126 125
      * @param string            $sFunction          The function or method (with class) name
127
-     * @param ...               $xParams            The parameters of the function or method
128 126
      *
129 127
      * @return \Jaxon\Request\Request
130 128
      */
Please login to merge, or discard this patch.
src/DI/Container.php 1 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 () {
112
+        $this->coreContainer[Jaxon::class] = function() {
113 113
             return new Jaxon();
114 114
         };
115 115
         // Global Response
116
-        $this->coreContainer[Response::class] = function () {
116
+        $this->coreContainer[Response::class] = function() {
117 117
             return new Response();
118 118
         };
119 119
         // Dialog
120
-        $this->coreContainer[Dialog::class] = function () {
120
+        $this->coreContainer[Dialog::class] = function() {
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 () {
128
+        $this->coreContainer[CallableRepository::class] = function() {
129 129
             return new CallableRepository();
130 130
         };
131 131
         // Plugin Manager
132
-        $this->coreContainer[PluginManager::class] = function () {
132
+        $this->coreContainer[PluginManager::class] = function() {
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 () {
144
+        $this->coreContainer[ParameterFactory::class] = function() {
145 145
             return new ParameterFactory();
146 146
         };
147 147
         // Response Manager
148
-        $this->coreContainer[ResponseManager::class] = function () {
148
+        $this->coreContainer[ResponseManager::class] = function() {
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 () {
159
+        $this->coreContainer[Config::class] = function() {
160 160
             return new Config();
161 161
         };
162
-        $this->coreContainer[ConfigReader::class] = function () {
162
+        $this->coreContainer[ConfigReader::class] = function() {
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 () {
170
+        $this->coreContainer[Minifier::class] = function() {
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 () {
194
+        $this->coreContainer[EventDispatcher::class] = function() {
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/Alert.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
     protected function alert($message, $title)
28 28
     {
29 29
         $title = ''; // Not used.
30
-        if($this->getReturn())
30
+        if ($this->getReturn())
31 31
         {
32 32
             return 'alert(' . $message . ')';
33 33
         }
Please login to merge, or discard this patch.
src/Plugin/Manager.php 2 patches
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 \Jaxon\Dialog\Interfaces\Alert);
134 134
         $bIsConfirm = ($xPlugin instanceof \Jaxon\Dialog\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', ['name' => get_class($xPlugin)]));
148 148
         }
149 149
         // This plugin implements the Alert interface
150
-        if($bIsAlert)
150
+        if ($bIsAlert)
151 151
         {
152 152
             jaxon()->dialog()->setAlert($xPlugin);
153 153
         }
154 154
         // This plugin implements the Confirm interface
155
-        if($bIsConfirm)
155
+        if ($bIsConfirm)
156 156
         {
157 157
             jaxon()->dialog()->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,14 +220,14 @@  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
                 // Register a function without options
228 228
                 $this->register(Jaxon::USER_FUNCTION, $xValue);
229 229
             }
230
-            elseif(is_string($xKey) && is_array($xValue))
230
+            elseif (is_string($xKey) && is_array($xValue))
231 231
             {
232 232
                 // Register a function with options
233 233
                 $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
@@ -241,22 +241,22 @@  discard block
 block discarded – undo
241 241
 
242 242
         // Register classes and directories
243 243
         $aClassesConfig = $xAppConfig->getOption('classes', []);
244
-        foreach($aClassesConfig as $xKey => $xValue)
244
+        foreach ($aClassesConfig as $xKey => $xValue)
245 245
         {
246
-            if(is_integer($xKey) && is_string($xValue))
246
+            if (is_integer($xKey) && is_string($xValue))
247 247
             {
248 248
                 // Register a class without options
249 249
                 $this->register(Jaxon::CALLABLE_CLASS, $xValue);
250 250
             }
251
-            elseif(is_string($xKey) && is_array($xValue))
251
+            elseif (is_string($xKey) && is_array($xValue))
252 252
             {
253 253
                 // Register a class with options
254 254
                 $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
255 255
             }
256
-            elseif(is_integer($xKey) && is_array($xValue))
256
+            elseif (is_integer($xKey) && is_array($xValue))
257 257
             {
258 258
                 // The directory path is required
259
-                if(!key_exists('directory', $xValue))
259
+                if (!key_exists('directory', $xValue))
260 260
                 {
261 261
                     continue;
262 262
                     // Todo: throw an exception
@@ -264,17 +264,17 @@  discard block
 block discarded – undo
264 264
                 // Registering a directory
265 265
                 $sDirectory = $xValue['directory'];
266 266
                 $aOptions = [];
267
-                if(key_exists('options', $xValue) &&
267
+                if (key_exists('options', $xValue) &&
268 268
                     is_array($xValue['options']) || is_string($xValue['options']))
269 269
                 {
270 270
                     $aOptions = $xValue['options'];
271 271
                 }
272 272
                 // Setup directory options
273
-                if(key_exists('namespace', $xValue))
273
+                if (key_exists('namespace', $xValue))
274 274
                 {
275 275
                     $aOptions['namespace'] = $xValue['namespace'];
276 276
                 }
277
-                if(key_exists('separator', $xValue))
277
+                if (key_exists('separator', $xValue))
278 278
                 {
279 279
                     $aOptions['separator'] = $xValue['separator'];
280 280
                 }
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
      */
300 300
     public function getResponsePlugin($sName)
301 301
     {
302
-        if(array_key_exists($sName, $this->aResponsePlugins))
302
+        if (array_key_exists($sName, $this->aResponsePlugins))
303 303
         {
304 304
             return $this->aResponsePlugins[$sName];
305 305
         }
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
      */
316 316
     public function getRequestPlugin($sName)
317 317
     {
318
-        if(array_key_exists($sName, $this->aRequestPlugins))
318
+        if (array_key_exists($sName, $this->aRequestPlugins))
319 319
         {
320 320
             return $this->aRequestPlugins[$sName];
321 321
         }
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', ['name' => get_class($xPlugin)]));
148 146
         }
@@ -226,13 +224,11 @@  discard block
 block discarded – undo
226 224
             {
227 225
                 // Register a function without options
228 226
                 $this->register(Jaxon::USER_FUNCTION, $xValue);
229
-            }
230
-            elseif(is_string($xKey) && is_array($xValue))
227
+            } elseif(is_string($xKey) && is_array($xValue))
231 228
             {
232 229
                 // Register a function with options
233 230
                 $this->register(Jaxon::USER_FUNCTION, $xKey, $xValue);
234
-            }
235
-            else
231
+            } else
236 232
             {
237 233
                 continue;
238 234
                 // Todo: throw an exception
@@ -247,13 +243,11 @@  discard block
 block discarded – undo
247 243
             {
248 244
                 // Register a class without options
249 245
                 $this->register(Jaxon::CALLABLE_CLASS, $xValue);
250
-            }
251
-            elseif(is_string($xKey) && is_array($xValue))
246
+            } elseif(is_string($xKey) && is_array($xValue))
252 247
             {
253 248
                 // Register a class with options
254 249
                 $this->register(Jaxon::CALLABLE_CLASS, $xKey, $xValue);
255
-            }
256
-            elseif(is_integer($xKey) && is_array($xValue))
250
+            } elseif(is_integer($xKey) && is_array($xValue))
257 251
             {
258 252
                 // The directory path is required
259 253
                 if(!key_exists('directory', $xValue))
@@ -280,8 +274,7 @@  discard block
 block discarded – undo
280 274
                 }
281 275
                 // Register a class without options
282 276
                 $this->register(Jaxon::CALLABLE_DIR, $sDirectory, $aOptions);
283
-            }
284
-            else
277
+            } else
285 278
             {
286 279
                 continue;
287 280
                 // Todo: throw an exception
Please login to merge, or discard this patch.