Passed
Push — main ( 683317...8fa9e1 )
by Thierry
04:59
created
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/Bootstrap.php 1 patch
Switch Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -23,58 +23,58 @@  discard block
 block discarded – undo
23 23
 
24 24
 class Bootstrap
25 25
 {
26
-    /**
26
+/**
27 27
      * The library options
28 28
      *
29 29
      * @var array
30 30
      */
31
-    private $aLibOptions = [];
31
+private $aLibOptions = [];
32 32
 
33
-    /**
33
+/**
34 34
      * The application options
35 35
      *
36 36
      * @var array
37 37
      */
38
-    private $aAppOptions = [];
38
+private $aAppOptions = [];
39 39
 
40
-    /**
40
+/**
41 41
      * The class constructor
42 42
      *
43 43
      * @param ConfigManager $xConfigManager
44 44
      * @param PackageManager $xPackageManager
45 45
      * @param CallbackManager $xCallbackManager
46 46
      */
47
-    public function __construct(private ConfigManager $xConfigManager,
48
-        private PackageManager $xPackageManager, private CallbackManager $xCallbackManager)
49
-    {}
47
+public function __construct(private ConfigManager $xConfigManager,
48
+private PackageManager $xPackageManager, private CallbackManager $xCallbackManager)
49
+{}
50 50
 
51
-    /**
51
+/**
52 52
      * Set the library options
53 53
      *
54 54
      * @param array $aLibOptions    The library options
55 55
      *
56 56
      * @return Bootstrap
57 57
      */
58
-    public function lib(array $aLibOptions): Bootstrap
59
-    {
60
-        $this->aLibOptions = $aLibOptions;
61
-        return $this;
62
-    }
58
+public function lib(array $aLibOptions): Bootstrap
59
+{
60
+$this->aLibOptions = $aLibOptions;
61
+return $this;
62
+}
63 63
 
64
-    /**
64
+/**
65 65
      * Set the applications options
66 66
      *
67 67
      * @param array $aAppOptions    The application options
68 68
      *
69 69
      * @return Bootstrap
70 70
      */
71
-    public function app(array $aAppOptions): Bootstrap
72
-    {
73
-        $this->aAppOptions = $aAppOptions;
74
-        return $this;
75
-    }
71
+public function app(array $aAppOptions): Bootstrap
72
+{
73
+$this->aAppOptions = $aAppOptions;
74
+return $this;
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * Set the javascript asset
79 79
      *
80 80
      * @param bool $bExport    Whether to export the js code in a file
@@ -84,75 +84,75 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @return Bootstrap
86 86
      */
87
-    public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): Bootstrap
88
-    {
89
-        // Jaxon library settings
90
-        $aJsOptions = [
91
-            'export' => $bExport,
92
-            'minify' => $bMinify,
93
-        ];
94
-        if($sUri !== '')
95
-        {
96
-            $aJsOptions['uri'] = $sUri;
97
-        }
98
-        if($sDir !== '')
99
-        {
100
-            $aJsOptions['dir'] = $sDir;
101
-        }
102
-        $this->xConfigManager->setOptions($aJsOptions, 'js.app');
103
-        return $this;
104
-    }
87
+public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): Bootstrap
88
+{
89
+// Jaxon library settings
90
+$aJsOptions = [
91
+'export' => $bExport,
92
+'minify' => $bMinify,
93
+];
94
+if($sUri !== '')
95
+{
96
+$aJsOptions['uri'] = $sUri;
97
+}
98
+if($sDir !== '')
99
+{
100
+$aJsOptions['dir'] = $sDir;
101
+}
102
+$this->xConfigManager->setOptions($aJsOptions, 'js.app');
103
+return $this;
104
+}
105 105
 
106
-    /**
106
+/**
107 107
      * Set the Jaxon application options.
108 108
      *
109 109
      * @return void
110 110
      * @throws SetupException
111 111
      */
112
-    private function setupApp(): void
113
-    {
114
-        // Save the app config.
115
-        $this->xConfigManager->setAppOptions($this->aAppOptions);
116
-        // Register user functions and classes
117
-        $this->xPackageManager->registerFromConfig();
118
-    }
112
+private function setupApp(): void
113
+{
114
+// Save the app config.
115
+$this->xConfigManager->setAppOptions($this->aAppOptions);
116
+// Register user functions and classes
117
+$this->xPackageManager->registerFromConfig();
118
+}
119 119
 
120
-    /**
120
+/**
121 121
      * Wraps the module/package/bundle setup method.
122 122
      *
123 123
      * @return void
124 124
      * @throws SetupException
125 125
      */
126
-    public function setup(): void
127
-    {
128
-        // Prevent the Jaxon library from sending the response or exiting
129
-        $this->xConfigManager->setOptions([
130
-            'response' => [
131
-                'send' => false,
132
-            ],
133
-            'process' => [
134
-                'exit' => false,
135
-            ],
136
-        ], 'core');
137
-        // Setup the lib config options.
138
-        $this->xConfigManager->setOptions($this->aLibOptions);
126
+public function setup(): void
127
+{
128
+// Prevent the Jaxon library from sending the response or exiting
129
+$this->xConfigManager->setOptions([
130
+'response' => [
131
+    'send' => false,
132
+],
133
+'process' => [
134
+    'exit' => false,
135
+],
136
+], 'core');
137
+// Setup the lib config options.
138
+$this->xConfigManager->setOptions($this->aLibOptions);
139 139
 
140
-        // Setup the app.
141
-        $this->setupApp();
142
-    }
140
+// Setup the app.
141
+$this->setupApp();
142
+}
143 143
 
144
-    /**
144
+/**
145 145
      * These callbacks are called once, after the library is initialized.
146 146
      *
147 147
      * @return void
148 148
      */
149
-    public function onBoot(): void
150
-    {
151
-        // Popping the callbacks makes each of them to be called once.
152
-        $aBootCallbacks = $this->xCallbackManager->popBootCallbacks();
153
-        foreach($aBootCallbacks as $aBootCallback)
154
-        {
155
-            call_user_func($aBootCallback);
156
-        }
157
-    }
149
+public function onBoot(): void
150
+{
151
+// Popping the callbacks makes each of them to be called once.
152
+$aBootCallbacks = $this->xCallbackManager->popBootCallbacks();
153
+foreach($aBootCallbacks as $aBootCallback)
154
+{
155
+call_user_func($aBootCallback);
156
+}
157
+}
158 158
 }
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/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.