Passed
Push — main ( 957ef0...483b9f )
by Thierry
04:08
created
jaxon-core/src/App/Ajax/Traits/ServicesTrait.php 1 patch
Switch Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -31,73 +31,73 @@  discard block
 block discarded – undo
31 31
 
32 32
 trait ServicesTrait
33 33
 {
34
-    use DiTrait;
34
+use DiTrait;
35 35
 
36
-    /**
36
+/**
37 37
      * @return Translator
38 38
      */
39
-    public function translator(): Translator
40
-    {
41
-        return $this->di()->g(Translator::class);
42
-    }
39
+public function translator(): Translator
40
+{
41
+return $this->di()->g(Translator::class);
42
+}
43 43
 
44
-    /**
44
+/**
45 45
      * @return LoggerInterface
46 46
      */
47
-    public function logger(): LoggerInterface
48
-    {
49
-        return $this->di()->getLogger();
50
-    }
47
+public function logger(): LoggerInterface
48
+{
49
+return $this->di()->getLogger();
50
+}
51 51
 
52
-    /**
52
+/**
53 53
      * @return Bootstrap
54 54
      */
55
-    protected function getBootstrap(): Bootstrap
56
-    {
57
-        return $this->di()->getBootstrap();
58
-    }
55
+protected function getBootstrap(): Bootstrap
56
+{
57
+return $this->di()->getBootstrap();
58
+}
59 59
 
60
-    /**
60
+/**
61 61
      * @return PluginManager
62 62
      */
63
-    protected function getPluginManager(): PluginManager
64
-    {
65
-        return $this->di()->getPluginManager();
66
-    }
63
+protected function getPluginManager(): PluginManager
64
+{
65
+return $this->di()->getPluginManager();
66
+}
67 67
 
68
-    /**
68
+/**
69 69
      * @return RequestHandler
70 70
      */
71
-    protected function getRequestHandler(): RequestHandler
72
-    {
73
-        return $this->di()->getRequestHandler();
74
-    }
71
+protected function getRequestHandler(): RequestHandler
72
+{
73
+return $this->di()->getRequestHandler();
74
+}
75 75
 
76
-    /**
76
+/**
77 77
      * @return ResponseManager
78 78
      */
79
-    protected function getResponseManager(): ResponseManager
80
-    {
81
-        return $this->di()->getResponseManager();
82
-    }
79
+protected function getResponseManager(): ResponseManager
80
+{
81
+return $this->di()->getResponseManager();
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * @return PackageManager
86 86
      */
87
-    protected function getPackageManager(): PackageManager
88
-    {
89
-        return $this->di()->getPackageManager();
90
-    }
87
+protected function getPackageManager(): PackageManager
88
+{
89
+return $this->di()->getPackageManager();
90
+}
91 91
 
92
-    /**
92
+/**
93 93
      * @return CodeGenerator
94 94
      */
95
-    protected function getCodeGenerator(): CodeGenerator
96
-    {
97
-        return $this->di()->getCodeGenerator();
98
-    }
95
+protected function getCodeGenerator(): CodeGenerator
96
+{
97
+return $this->di()->getCodeGenerator();
98
+}
99 99
 
100
-    /**
100
+/**
101 101
      * Add a view renderer with an id
102 102
      *
103 103
      * @param string $sRenderer    The renderer name
@@ -106,70 +106,70 @@  discard block
 block discarded – undo
106 106
      *
107 107
      * @return void
108 108
      */
109
-    public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure): void
110
-    {
111
-        $this->view()->setDefaultRenderer($sRenderer, $sExtension, $xClosure);
112
-    }
109
+public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure): void
110
+{
111
+$this->view()->setDefaultRenderer($sRenderer, $sExtension, $xClosure);
112
+}
113 113
 
114
-    /**
114
+/**
115 115
      * @param LoggerInterface|Closure $xLogger
116 116
      *
117 117
      * @return void
118 118
      */
119
-    public function setLogger(LoggerInterface|Closure $xLogger): void
120
-    {
121
-        $this->di()->setLogger($xLogger);
122
-    }
119
+public function setLogger(LoggerInterface|Closure $xLogger): void
120
+{
121
+$this->di()->setLogger($xLogger);
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * Set the session manager
126 126
      *
127 127
      * @param Closure $xClosure    A closure to create the session manager instance
128 128
      *
129 129
      * @return void
130 130
      */
131
-    public function setSessionManager(Closure $xClosure): void
132
-    {
133
-        $this->di()->setSessionManager($xClosure);
134
-    }
131
+public function setSessionManager(Closure $xClosure): void
132
+{
133
+$this->di()->setSessionManager($xClosure);
134
+}
135 135
 
136
-    /**
136
+/**
137 137
      * @return UploadHandlerInterface|null
138 138
      */
139
-    public function upload(): ?UploadHandlerInterface
140
-    {
141
-        return $this->di()->getUploadHandler();
142
-    }
139
+public function upload(): ?UploadHandlerInterface
140
+{
141
+return $this->di()->getUploadHandler();
142
+}
143 143
 
144
-    /**
144
+/**
145 145
      * @return PsrFactory
146 146
      */
147
-    public function psr(): PsrFactory
148
-    {
149
-        return $this->di()->getPsrFactory();
150
-    }
147
+public function psr(): PsrFactory
148
+{
149
+return $this->di()->getPsrFactory();
150
+}
151 151
 
152
-    /**
152
+/**
153 153
      * @return TemplateEngine
154 154
      */
155
-    public function template(): TemplateEngine
156
-    {
157
-        return $this->di()->getTemplateEngine();
158
-    }
155
+public function template(): TemplateEngine
156
+{
157
+return $this->di()->getTemplateEngine();
158
+}
159 159
 
160
-    /**
160
+/**
161 161
      * @return ViewRenderer
162 162
      */
163
-    public function view(): ViewRenderer
164
-    {
165
-        return $this->di()->getViewRenderer();
166
-    }
163
+public function view(): ViewRenderer
164
+{
165
+return $this->di()->getViewRenderer();
166
+}
167 167
 
168
-    /**
168
+/**
169 169
      * @return SessionInterface|null
170 170
      */
171
-    public function session(): ?SessionInterface
172
-    {
173
-        return $this->di()->getSessionManager();
174
-    }
171
+public function session(): ?SessionInterface
172
+{
173
+return $this->di()->getSessionManager();
174
+}
175 175
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Ajax/Traits/PluginTrait.php 1 patch
Switch Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -28,27 +28,27 @@  discard block
 block discarded – undo
28 28
 
29 29
 trait PluginTrait
30 30
 {
31
-    /**
31
+/**
32 32
      * @return PluginManager
33 33
      */
34
-    abstract public function getPluginManager(): PluginManager;
34
+abstract public function getPluginManager(): PluginManager;
35 35
 
36
-    /**
36
+/**
37 37
      * @return PackageManager
38 38
      */
39
-    abstract public function getPackageManager(): PackageManager;
39
+abstract public function getPackageManager(): PackageManager;
40 40
 
41
-    /**
41
+/**
42 42
      * @return CodeGenerator
43 43
      */
44
-    abstract public function getCodeGenerator(): CodeGenerator;
44
+abstract public function getCodeGenerator(): CodeGenerator;
45 45
 
46
-    /**
46
+/**
47 47
      * @return Bootstrap
48 48
      */
49
-    abstract protected function getBootstrap(): Bootstrap;
49
+abstract protected function getBootstrap(): Bootstrap;
50 50
 
51
-    /**
51
+/**
52 52
      * Register request handlers, including functions, callable classes and directories.
53 53
      *
54 54
      * @param string $sType    The type of request handler being registered
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
      * @return void
66 66
      * @throws SetupException
67 67
      */
68
-    public function register(string $sType, string $sName, $xOptions = []): void
69
-    {
70
-        $this->getPluginManager()->registerCallable($sType, $sName, $xOptions);
71
-    }
68
+public function register(string $sType, string $sName, $xOptions = []): void
69
+{
70
+$this->getPluginManager()->registerCallable($sType, $sName, $xOptions);
71
+}
72 72
 
73
-    /**
73
+/**
74 74
      * Register a plugin
75 75
      *
76 76
      * Below is a table for priorities and their description:
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
      * @return void
86 86
      * @throws SetupException
87 87
      */
88
-    public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000)
89
-    {
90
-        $this->getPluginManager()->registerPlugin($sClassName, $sPluginName, $nPriority);
91
-    }
88
+public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000)
89
+{
90
+$this->getPluginManager()->registerPlugin($sClassName, $sPluginName, $nPriority);
91
+}
92 92
 
93
-    /**
93
+/**
94 94
      * Register a package
95 95
      *
96 96
      * @param string $sClassName    The package class
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
      * @return void
100 100
      * @throws SetupException
101 101
      */
102
-    public function registerPackage(string $sClassName, array $xPkgOptions = [])
103
-    {
104
-        $this->getPackageManager()->registerPackage($sClassName, $xPkgOptions);
105
-    }
102
+public function registerPackage(string $sClassName, array $xPkgOptions = [])
103
+{
104
+$this->getPackageManager()->registerPackage($sClassName, $xPkgOptions);
105
+}
106 106
 
107
-    /**
107
+/**
108 108
      * Find a response plugin by name or class name
109 109
      *
110 110
      * @template R of ResponsePluginInterface
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
      *
113 113
      * @return ($sName is class-string ? R : ResponsePluginInterface)|null
114 114
      */
115
-    public function plugin(string $sName): ResponsePluginInterface|null
116
-    {
117
-        return $this->getPluginManager()->getResponsePlugin($sName);
118
-    }
115
+public function plugin(string $sName): ResponsePluginInterface|null
116
+{
117
+return $this->getPluginManager()->getResponsePlugin($sName);
118
+}
119 119
 
120
-    /**
120
+/**
121 121
      * Get a package instance
122 122
      *
123 123
      * @template P of AbstractPackage
@@ -125,52 +125,52 @@  discard block
 block discarded – undo
125 125
      *
126 126
      * @return P|null
127 127
      */
128
-    public function package(string $sClassName): ?AbstractPackage
129
-    {
130
-        return $this->getPackageManager()->getPackage($sClassName);
131
-    }
128
+public function package(string $sClassName): ?AbstractPackage
129
+{
130
+return $this->getPackageManager()->getPackage($sClassName);
131
+}
132 132
 
133
-    /**
133
+/**
134 134
      * Get the HTML tags to include Jaxon javascript files into the page.
135 135
      *
136 136
      * @return string
137 137
      */
138
-    public function getJs(): string
139
-    {
140
-        return $this->getCodeGenerator()->getJs();
141
-    }
138
+public function getJs(): string
139
+{
140
+return $this->getCodeGenerator()->getJs();
141
+}
142 142
 
143
-    /**
143
+/**
144 144
      * Get the HTML tags to include Jaxon javascript files into the page.
145 145
      *
146 146
      * @return string  the javascript code
147 147
      */
148
-    public function js(): string
149
-    {
150
-        return $this->getCodeGenerator()->getJs();
151
-    }
148
+public function js(): string
149
+{
150
+return $this->getCodeGenerator()->getJs();
151
+}
152 152
 
153
-    /**
153
+/**
154 154
      * Get the HTML tags to include Jaxon CSS code and files into the page.
155 155
      *
156 156
      * @return string
157 157
      */
158
-    public function getCss(): string
159
-    {
160
-        return $this->getCodeGenerator()->getCss();
161
-    }
158
+public function getCss(): string
159
+{
160
+return $this->getCodeGenerator()->getCss();
161
+}
162 162
 
163
-    /**
163
+/**
164 164
      * Get the HTML tags to include Jaxon CSS code and files into the page.
165 165
      *
166 166
      * @return string
167 167
      */
168
-    public function css(): string
169
-    {
170
-        return $this->getCodeGenerator()->getCss();
171
-    }
168
+public function css(): string
169
+{
170
+return $this->getCodeGenerator()->getCss();
171
+}
172 172
 
173
-    /**
173
+/**
174 174
      * Returns the js header and wrapper code to be printed into the page
175 175
      *
176 176
      * The javascript code returned by this function depends on the plugins
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
      * @return string
183 183
      * @throws UriException
184 184
      */
185
-    public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string
186
-    {
187
-        return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss);
188
-    }
185
+public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string
186
+{
187
+return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss);
188
+}
189 189
 
190
-    /**
190
+/**
191 191
      * Returns the js header and wrapper code to be printed into the page
192 192
      *
193 193
      * @param bool $bIncludeJs    Also get the js code
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
      * @return string  the javascript code
197 197
      * @throws UriException
198 198
      */
199
-    public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string
200
-    {
201
-        return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss);
202
-    }
199
+public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string
200
+{
201
+return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss);
202
+}
203 203
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Ajax/Jaxon.php 1 patch
Switch Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -32,110 +32,110 @@
 block discarded – undo
32 32
 
33 33
 final class Jaxon
34 34
 {
35
-    use Traits\ConfigTrait;
36
-    use Traits\ServicesTrait;
37
-    use Traits\PluginTrait;
38
-    use Traits\RequestTrait;
39
-    use Traits\ResponseTrait;
40
-    use Traits\SendResponseTrait;
41
-
42
-    /**
35
+use Traits\ConfigTrait;
36
+use Traits\ServicesTrait;
37
+use Traits\PluginTrait;
38
+use Traits\RequestTrait;
39
+use Traits\ResponseTrait;
40
+use Traits\SendResponseTrait;
41
+
42
+/**
43 43
      * @var Jaxon|null
44 44
      */
45
-    private static $xInstance = null;
45
+private static $xInstance = null;
46 46
 
47
-    /**
47
+/**
48 48
      * The constructor
49 49
      *
50 50
      * @param Container $xContainer
51 51
      * @param ComponentContainer $xComponentContainer
52 52
      */
53
-    private function __construct(Container $xContainer, ComponentContainer $xComponentContainer)
54
-    {
55
-        $this->xContainer = $xContainer;
56
-        $this->xComponentContainer = $xComponentContainer;
57
-    }
53
+private function __construct(Container $xContainer, ComponentContainer $xComponentContainer)
54
+{
55
+$this->xContainer = $xContainer;
56
+$this->xComponentContainer = $xComponentContainer;
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * @return Jaxon
61 61
      */
62
-    private static function createInstance(): Jaxon
63
-    {
64
-        $xContainer = new Container();
65
-        $xComponentContainer = new ComponentContainer($xContainer);
66
-        self::$xInstance = new Jaxon($xContainer, $xComponentContainer);
62
+private static function createInstance(): Jaxon
63
+{
64
+$xContainer = new Container();
65
+$xComponentContainer = new ComponentContainer($xContainer);
66
+self::$xInstance = new Jaxon($xContainer, $xComponentContainer);
67 67
 
68
-        // Save the Jaxon and container instances
69
-        $xContainer->val(Jaxon::class, self::$xInstance);
70
-        $xContainer->val(ComponentContainer::class, $xComponentContainer);
68
+// Save the Jaxon and container instances
69
+$xContainer->val(Jaxon::class, self::$xInstance);
70
+$xContainer->val(ComponentContainer::class, $xComponentContainer);
71 71
 
72
-        // Make the helpers functions available in the global namespace.
73
-        self::$xInstance->callback()->boot(function() {
74
-            self::$xInstance->config()->globals();
75
-        });
72
+// Make the helpers functions available in the global namespace.
73
+self::$xInstance->callback()->boot(function() {
74
+self::$xInstance->config()->globals();
75
+});
76 76
 
77
-        return self::$xInstance;
78
-    }
77
+return self::$xInstance;
78
+}
79 79
 
80
-    /**
80
+/**
81 81
      * @return Jaxon
82 82
      */
83
-    public static function getInstance(): Jaxon
84
-    {
85
-        return self::$xInstance ?: self::$xInstance = self::createInstance();
86
-    }
83
+public static function getInstance(): Jaxon
84
+{
85
+return self::$xInstance ?: self::$xInstance = self::createInstance();
86
+}
87 87
 
88
-    /**
88
+/**
89 89
      * @return string
90 90
      */
91
-    public function getVersion(): string
92
-    {
93
-        return \Jaxon\Jaxon::VERSION;
94
-    }
91
+public function getVersion(): string
92
+{
93
+return \Jaxon\Jaxon::VERSION;
94
+}
95 95
 
96
-    /**
96
+/**
97 97
      * @return ConfigManager
98 98
      */
99
-    public function config(): ConfigManager
100
-    {
101
-        return $this->xContainer->config();
102
-    }
99
+public function config(): ConfigManager
100
+{
101
+return $this->xContainer->config();
102
+}
103 103
 
104
-    /**
104
+/**
105 105
      * Set the ajax endpoint URI
106 106
      *
107 107
      * @param string $sUri    The ajax endpoint URI
108 108
      *
109 109
      * @return void
110 110
      */
111
-    public function setUri(string $sUri): void
112
-    {
113
-        $this->config()->setOption('core.request.uri', $sUri);
114
-    }
111
+public function setUri(string $sUri): void
112
+{
113
+$this->config()->setOption('core.request.uri', $sUri);
114
+}
115 115
 
116
-    /**
116
+/**
117 117
      * @return AppInterface
118 118
      */
119
-    public function app(): AppInterface
120
-    {
121
-        return $this->xContainer->getApp();
122
-    }
119
+public function app(): AppInterface
120
+{
121
+return $this->xContainer->getApp();
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * Get the callback manager
126 126
      *
127 127
      * @return CallbackManager
128 128
      */
129
-    public function callback(): CallbackManager
130
-    {
131
-        return $this->xContainer->callback();
132
-    }
129
+public function callback(): CallbackManager
130
+{
131
+return $this->xContainer->callback();
132
+}
133 133
 
134
-    /**
134
+/**
135 135
      * @return void
136 136
      */
137
-    public function reset(): void
138
-    {
139
-        self::$xInstance = null;
140
-    }
137
+public function reset(): void
138
+{
139
+self::$xInstance = null;
140
+}
141 141
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Code/CodeGenerator.php 1 patch
Spacing   +20 added lines, -22 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      */
110 110
     public function addCodeGenerator(string $sClassName, int $nPriority): void
111 111
     {
112
-        while(isset($this->aCodeGenerators[$nPriority]))
112
+        while (isset($this->aCodeGenerators[$nPriority]))
113 113
         {
114 114
             $nPriority++;
115 115
         }
@@ -162,33 +162,33 @@  discard block
 block discarded – undo
162 162
      */
163 163
     private function generatePluginCodes(CodeGeneratorInterface $xGenerator): void
164 164
     {
165
-        if(!is_subclass_of($xGenerator, AbstractPlugin::class) ||
165
+        if (!is_subclass_of($xGenerator, AbstractPlugin::class) ||
166 166
             $this->xAssetManager->shallIncludeAssets($xGenerator))
167 167
         {
168 168
             // HTML tags for CSS
169
-            if(($sCss = trim($xGenerator->getCss(), " \n")) !== '')
169
+            if (($sCss = trim($xGenerator->getCss(), " \n")) !== '')
170 170
             {
171 171
                 $this->aCss[] = $sCss;
172 172
             }
173 173
             // HTML tags for js
174
-            if(($sJs = trim($xGenerator->getJs(), " \n")) !== '')
174
+            if (($sJs = trim($xGenerator->getJs(), " \n")) !== '')
175 175
             {
176 176
                 $this->aJs[] = $sJs;
177 177
             }
178 178
         }
179 179
 
180 180
         // Additional js codes
181
-        if(($xJsCode = $xGenerator->getJsCode()) !== null)
181
+        if (($xJsCode = $xGenerator->getJsCode()) !== null)
182 182
         {
183
-            if(($sJs = trim($xJsCode->sJs, " \n")) !== '')
183
+            if (($sJs = trim($xJsCode->sJs, " \n")) !== '')
184 184
             {
185 185
                 $this->aCodeJs[] = $sJs;
186 186
             }
187
-            if(($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '')
187
+            if (($sJsBefore = trim($xJsCode->sJsBefore, " \n")) !== '')
188 188
             {
189 189
                 $this->aCodeJsBefore[] = $sJsBefore;
190 190
             }
191
-            if(($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '')
191
+            if (($sJsAfter = trim($xJsCode->sJsAfter, " \n")) !== '')
192 192
             {
193 193
                 $this->aCodeJsAfter[] = $sJsAfter;
194 194
             }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     private function generateCodes(): void
206 206
     {
207
-        if($this->bGenerated)
207
+        if ($this->bGenerated)
208 208
         {
209 209
             return;
210 210
         }
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
         $this->xAssetManager = $this->di->getAssetManager();
220 220
 
221 221
         $this->sJsOptions = $this->xAssetManager->getJsOptions();
222
-        foreach($this->aCodeGenerators as $sClassName)
222
+        foreach ($this->aCodeGenerators as $sClassName)
223 223
         {
224 224
             $this->generatePluginCodes($this->getCodeGenerator($sClassName));
225 225
         }
@@ -265,11 +265,11 @@  discard block
 block discarded – undo
265 265
     public function getJsScript(): string
266 266
     {
267 267
         $aJsScripts = [];
268
-        foreach($this->aCodeGenerators as $sClassName)
268
+        foreach ($this->aCodeGenerators as $sClassName)
269 269
         {
270 270
             $xGenerator = $this->getCodeGenerator($sClassName);
271 271
             // Javascript code
272
-            if(($sJsScript = trim($xGenerator->getScript(), " \n")) !== '')
272
+            if (($sJsScript = trim($xGenerator->getScript(), " \n")) !== '')
273 273
             {
274 274
                 $aJsScripts[] = $sJsScript;
275 275
             }
@@ -286,38 +286,36 @@  discard block
 block discarded – undo
286 286
     private function renderCodes(bool $bIncludeJs, bool $bIncludeCss): array
287 287
     {
288 288
         $aCodes = [];
289
-        if($bIncludeCss)
289
+        if ($bIncludeCss)
290 290
         {
291 291
             $aCodes[] = $this->getCss();
292 292
         }
293
-        if($bIncludeJs)
293
+        if ($bIncludeJs)
294 294
         {
295 295
             $aCodes[] = $this->getJs();
296 296
         }
297 297
 
298
-        $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' :
299
-            $this->xAssetManager->createJsFiles($this);
298
+        $sUrl = !$this->xAssetManager->shallCreateJsFiles() ? '' : $this->xAssetManager->createJsFiles($this);
300 299
         // Wrap the js code into the corresponding HTML tag.
301 300
         $aCodes[] = $sUrl !== '' ?
302
-            $this->render('include.js', ['sUrl' => $sUrl]) :
303
-            $this->render('wrapper.js', ['sScript' => $this->getJsScript()]);
301
+            $this->render('include.js', ['sUrl' => $sUrl]) : $this->render('wrapper.js', ['sScript' => $this->getJsScript()]);
304 302
 
305 303
         // Wrap the js codes into HTML tags.
306
-        if(count($this->aCodeJsBefore) > 0)
304
+        if (count($this->aCodeJsBefore) > 0)
307 305
         {
308 306
             $sScript = implode("\n\n", $this->aCodeJsBefore);
309 307
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
310 308
         }
311
-        if(count($this->aCodeJs) > 0)
309
+        if (count($this->aCodeJs) > 0)
312 310
         {
313 311
             $sScript = implode("\n\n", $this->aCodeJs);
314 312
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
315 313
         }
316
-        if(count($this->aCodeJsFiles) > 0)
314
+        if (count($this->aCodeJsFiles) > 0)
317 315
         {
318 316
             $aCodes[] = $this->render('includes.js', ['aUrls' => $this->aCodeJsFiles]);
319 317
         }
320
-        if(count($this->aCodeJsAfter) > 0)
318
+        if (count($this->aCodeJsAfter) > 0)
321 319
         {
322 320
             $sScript = implode("\n\n", $this->aCodeJsAfter);
323 321
             $aCodes[] = $this->render('wrapper.js', ['sScript' => $sScript]);
Please login to merge, or discard this patch.
jaxon-core/src/App/Component/Logger.php 1 patch
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 
8 8
 class Logger
9 9
 {
10
-    use LoggerTrait;
10
+use LoggerTrait;
11 11
 
12
-    /**
12
+/**
13 13
      * @param LoggerInterface $logger
14 14
      */
15
-    public function __construct(private LoggerInterface $logger)
16
-    {}
15
+public function __construct(private LoggerInterface $logger)
16
+{}
17 17
 
18
-    /**
18
+/**
19 19
      * Logs with an arbitrary level.
20 20
      *
21 21
      * @param mixed  $level
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
      *
25 25
      * @return void
26 26
      */
27
-    public function log($level, string|\Stringable $message, array $context = []): void
28
-    {
29
-        $this->logger->log($level, $message, $context);
30
-    }
27
+public function log($level, string|\Stringable $message, array $context = []): void
28
+{
29
+$this->logger->log($level, $message, $context);
30
+}
31 31
 }
Please login to merge, or discard this patch.
jaxon-core/templates/plugins/config.js.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
 jaxon.config.defaultMethod = '<?php echo $this->sDefaultMethod ?>';
7 7
 jaxon.config.responseType = '<?php echo $this->sResponseType ?>';
8 8
 
9
-<?php if($this->nResponseQueueSize > 0): ?>
9
+<?php if ($this->nResponseQueueSize > 0): ?>
10 10
 jaxon.config.responseQueueSize = <?php echo $this->nResponseQueueSize ?>;
11 11
 <?php endif ?>
12 12
 
13
-<?php if($this->bLoggingEnabled): ?>
13
+<?php if ($this->bLoggingEnabled): ?>
14 14
 jaxon.debug.logger = '<?php echo Jaxon\rq(Jaxon\App\Component\Logger::class)->_class() ?>';
15 15
 <?php endif ?>
16 16
 
17
-<?php if($this->bDebug): ?>
17
+<?php if ($this->bDebug): ?>
18 18
 jaxon.debug.active = true;
19
-<?php if($this->sDebugOutputID): ?>
19
+<?php if ($this->sDebugOutputID): ?>
20 20
 jaxon.debug.outputID = '<?php echo $this->sDebugOutputID ?>';
21 21
 <?php endif ?>
22
-<?php if($this->bVerboseDebug): ?>
22
+<?php if ($this->bVerboseDebug): ?>
23 23
 jaxon.debug.verbose.active = true;
24 24
 <?php endif ?>
25 25
 <?php endif ?>
26 26
 
27
-<?php if($this->sCsrfMetaName): ?>
27
+<?php if ($this->sCsrfMetaName): ?>
28 28
 jaxon.setCsrf('<?php echo $this->sCsrfMetaName ?>');
29 29
 <?php endif ?>
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/PsrTrait.php 1 patch
Switch Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -18,150 +18,150 @@
 block discarded – undo
18 18
 
19 19
 trait PsrTrait
20 20
 {
21
-    /**
21
+/**
22 22
      * @var string
23 23
      */
24
-    private $sPsrConfig = 'jaxon.psr.config.file';
24
+private $sPsrConfig = 'jaxon.psr.config.file';
25 25
 
26
-    /**
26
+/**
27 27
      * @var string
28 28
      */
29
-    private $sPsrServerRequest = 'jaxon.psr.server.request';
29
+private $sPsrServerRequest = 'jaxon.psr.server.request';
30 30
 
31
-    /**
31
+/**
32 32
      * Register the values into the container
33 33
      *
34 34
      * @return void
35 35
      */
36
-    private function registerPsr(): void
37
-    {
38
-        // The server request
39
-        $this->set(Psr17Factory::class, function() {
40
-            return new Psr17Factory();
41
-        });
42
-        $this->set(ServerRequestCreator::class, function($di) {
43
-            $xPsr17Factory = $di->g(Psr17Factory::class);
44
-            return new ServerRequestCreator(
45
-                $xPsr17Factory, // ServerRequestFactory
46
-                $xPsr17Factory, // UriFactory
47
-                $xPsr17Factory, // UploadedFileFactory
48
-                $xPsr17Factory, // StreamFactory
49
-            );
50
-        });
51
-        $this->set(ServerRequestInterface::class, function($di) {
52
-            return $di->g(ServerRequestCreator::class)->fromGlobals();
53
-        });
54
-        // Server request with the Jaxon request parameter as attribute
55
-        $this->set($this->sPsrServerRequest, function($di) {
56
-            /** @var ParameterReader */
57
-            $xParameterReader = $di->g(ParameterReader::class);
58
-            return $xParameterReader->setRequestParameter($di->g(ServerRequestInterface::class));
59
-        });
60
-        // PSR factory
61
-        $this->set(PsrFactory::class, function($di) {
62
-            return new PsrFactory($di->g(Container::class));
63
-        });
64
-        // PSR request handler
65
-        $this->set(PsrRequestHandler::class, function($di) {
66
-            return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
67
-                $di->g(ResponseManager::class), $di->g(Translator::class));
68
-        });
69
-        // PSR config middleware
70
-        $this->set(PsrConfigMiddleware::class, function($di) {
71
-            return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
72
-        });
73
-        // PSR ajax middleware
74
-        $this->set(PsrAjaxMiddleware::class, function($di) {
75
-            return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
76
-                $di->g(ResponseManager::class));
77
-        });
78
-        // The PSR response plugin
79
-        $this->set(PsrPlugin::class, function($di) {
80
-            return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
81
-        });
82
-    }
36
+private function registerPsr(): void
37
+{
38
+// The server request
39
+$this->set(Psr17Factory::class, function() {
40
+return new Psr17Factory();
41
+});
42
+$this->set(ServerRequestCreator::class, function($di) {
43
+$xPsr17Factory = $di->g(Psr17Factory::class);
44
+return new ServerRequestCreator(
45
+    $xPsr17Factory, // ServerRequestFactory
46
+    $xPsr17Factory, // UriFactory
47
+    $xPsr17Factory, // UploadedFileFactory
48
+    $xPsr17Factory, // StreamFactory
49
+);
50
+});
51
+$this->set(ServerRequestInterface::class, function($di) {
52
+return $di->g(ServerRequestCreator::class)->fromGlobals();
53
+});
54
+// Server request with the Jaxon request parameter as attribute
55
+$this->set($this->sPsrServerRequest, function($di) {
56
+/** @var ParameterReader */
57
+$xParameterReader = $di->g(ParameterReader::class);
58
+return $xParameterReader->setRequestParameter($di->g(ServerRequestInterface::class));
59
+});
60
+// PSR factory
61
+$this->set(PsrFactory::class, function($di) {
62
+return new PsrFactory($di->g(Container::class));
63
+});
64
+// PSR request handler
65
+$this->set(PsrRequestHandler::class, function($di) {
66
+return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
67
+    $di->g(ResponseManager::class), $di->g(Translator::class));
68
+});
69
+// PSR config middleware
70
+$this->set(PsrConfigMiddleware::class, function($di) {
71
+return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
72
+});
73
+// PSR ajax middleware
74
+$this->set(PsrAjaxMiddleware::class, function($di) {
75
+return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
76
+    $di->g(ResponseManager::class));
77
+});
78
+// The PSR response plugin
79
+$this->set(PsrPlugin::class, function($di) {
80
+return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
81
+});
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * Get the request
86 86
      *
87 87
      * @return array
88 88
      */
89
-    public function getServerParams(): array
90
-    {
91
-        $xRequest = $this->g(ServerRequestInterface::class);
92
-        return $xRequest->getServerParams();
93
-    }
89
+public function getServerParams(): array
90
+{
91
+$xRequest = $this->g(ServerRequestInterface::class);
92
+return $xRequest->getServerParams();
93
+}
94 94
 
95
-    /**
95
+/**
96 96
      * Get the request with Jaxon parameter as attribute
97 97
      *
98 98
      * @return ServerRequestInterface
99 99
      */
100
-    public function getRequest(): ServerRequestInterface
101
-    {
102
-        return $this->g($this->sPsrServerRequest);
103
-    }
100
+public function getRequest(): ServerRequestInterface
101
+{
102
+return $this->g($this->sPsrServerRequest);
103
+}
104 104
 
105
-    /**
105
+/**
106 106
      * Return the array of arguments from the GET or POST data
107 107
      *
108 108
      * @return array
109 109
      */
110
-    public function getRequestArguments(): array
111
-    {
112
-        return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
113
-    }
110
+public function getRequestArguments(): array
111
+{
112
+return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
113
+}
114 114
 
115
-    /**
115
+/**
116 116
      * Get the PSR factory
117 117
      *
118 118
      * @return PsrFactory
119 119
      */
120
-    public function getPsrFactory(): PsrFactory
121
-    {
122
-        return $this->g(PsrFactory::class);
123
-    }
120
+public function getPsrFactory(): PsrFactory
121
+{
122
+return $this->g(PsrFactory::class);
123
+}
124 124
 
125
-    /**
125
+/**
126 126
      * Get the Psr17 factory
127 127
      *
128 128
      * @return Psr17Factory
129 129
      */
130
-    public function getPsr17Factory(): Psr17Factory
131
-    {
132
-        return $this->g(Psr17Factory::class);
133
-    }
130
+public function getPsr17Factory(): Psr17Factory
131
+{
132
+return $this->g(Psr17Factory::class);
133
+}
134 134
 
135
-    /**
135
+/**
136 136
      * Get the PSR request handler
137 137
      *
138 138
      * @return PsrRequestHandler
139 139
      */
140
-    public function getPsrRequestHandler(): PsrRequestHandler
141
-    {
142
-        return $this->g(PsrRequestHandler::class);
143
-    }
140
+public function getPsrRequestHandler(): PsrRequestHandler
141
+{
142
+return $this->g(PsrRequestHandler::class);
143
+}
144 144
 
145
-    /**
145
+/**
146 146
      * Get the PSR config middleware
147 147
      *
148 148
      * @param string $sConfigFile
149 149
      *
150 150
      * @return PsrConfigMiddleware
151 151
      */
152
-    public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
153
-    {
154
-        !$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
155
-        return $this->g(PsrConfigMiddleware::class);
156
-    }
152
+public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
153
+{
154
+!$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
155
+return $this->g(PsrConfigMiddleware::class);
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * Get the PSR ajax request middleware
160 160
      *
161 161
      * @return PsrAjaxMiddleware
162 162
      */
163
-    public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
164
-    {
165
-        return $this->g(PsrAjaxMiddleware::class);
166
-    }
163
+public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
164
+{
165
+return $this->g(PsrAjaxMiddleware::class);
166
+}
167 167
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/NodeComponent.php 1 patch
Switch Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -8,71 +8,71 @@
 block discarded – undo
8 8
 
9 9
 abstract class NodeComponent extends Component\AbstractComponent
10 10
 {
11
-    use Component\HelperTrait;
12
-    use Component\NodeResponseTrait;
13
-    use Component\AjaxResponseTrait;
14
-    use Component\ComponentTrait;
11
+use Component\HelperTrait;
12
+use Component\NodeResponseTrait;
13
+use Component\AjaxResponseTrait;
14
+use Component\ComponentTrait;
15 15
 
16
-    /**
16
+/**
17 17
      * @inheritDoc
18 18
      */
19
-    final protected function initComponent(Container $di, ComponentHelper $xHelper): void
20
-    {
21
-        $this->setHelper($xHelper);
22
-        $this->setNodeResponse($di);
23
-        $this->setAjaxResponse($di);
24
-    }
19
+final protected function initComponent(Container $di, ComponentHelper $xHelper): void
20
+{
21
+$this->setHelper($xHelper);
22
+$this->setNodeResponse($di);
23
+$this->setAjaxResponse($di);
24
+}
25 25
 
26
-    /**
26
+/**
27 27
      * @return string|Stringable
28 28
      */
29
-    abstract public function html(): string|Stringable;
29
+abstract public function html(): string|Stringable;
30 30
 
31
-    /**
31
+/**
32 32
      * Called before rendering the component.
33 33
      *
34 34
      * @return void
35 35
      */
36
-    protected function before(): void
37
-    {}
36
+protected function before(): void
37
+{}
38 38
 
39
-    /**
39
+/**
40 40
      * Called after rendering the component.
41 41
      *
42 42
      * @return void
43 43
      */
44
-    protected function after(): void
45
-    {}
44
+protected function after(): void
45
+{}
46 46
 
47
-    /**
47
+/**
48 48
      * Set the attached DOM node content with the component HTML code.
49 49
      *
50 50
      * @return void
51 51
      */
52
-    final public function render(): void
53
-    {
54
-        $this->before();
55
-        $this->node()->html((string)$this->html());
56
-        $this->after();
57
-    }
52
+final public function render(): void
53
+{
54
+$this->before();
55
+$this->node()->html((string)$this->html());
56
+$this->after();
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * Clear the attached DOM node content.
61 61
      *
62 62
      * @return void
63 63
      */
64
-    final public function clear(): void
65
-    {
66
-        $this->node()->clear();
67
-    }
64
+final public function clear(): void
65
+{
66
+$this->node()->clear();
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * Show/hide the attached DOM node.
71 71
      *
72 72
      * @return void
73 73
      */
74
-    final public function visible(bool $bVisible): void
75
-    {
76
-        $bVisible ? $this->node()->jq()->show() : $this->node()->jq()->hide();
77
-    }
74
+final public function visible(bool $bVisible): void
75
+{
76
+$bVisible ? $this->node()->jq()->show() : $this->node()->jq()->hide();
77
+}
78 78
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Dialog/ModalInterface.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 interface ModalInterface
18 18
 {
19
-    /**
19
+/**
20 20
      * Show a modal dialog.
21 21
      *
22 22
      * @param string $sTitle The title of the dialog
@@ -26,12 +26,12 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @return void
28 28
      */
29
-    public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void;
29
+public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void;
30 30
 
31
-    /**
31
+/**
32 32
      * Hide the modal dialog.
33 33
      *
34 34
      * @return void
35 35
      */
36
-    public function hide(): void;
36
+public function hide(): void;
37 37
 }
Please login to merge, or discard this patch.