Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-dialogs/src/Dialog/Library/Bootstrap5.php 1 patch
Switch Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -19,16 +19,16 @@
 block discarded – undo
19 19
 
20 20
 class Bootstrap5 extends AbstractLibrary implements ModalInterface 
21 21
 {
22
-    /**
22
+/**
23 23
      * @const The library name
24 24
      */
25
-    public const NAME = 'bootstrap5';
25
+public const NAME = 'bootstrap5';
26 26
 
27
-    /**
27
+/**
28 28
      * @inheritDoc
29 29
      */
30
-    public function getName(): string
31
-    {
32
-        return self::NAME;
33
-    }
30
+public function getName(): string
31
+{
32
+return self::NAME;
33
+}
34 34
 }
Please login to merge, or discard this patch.
jaxon-dialogs/src/Dialog/Library/JQueryConfirm.php 1 patch
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -20,40 +20,40 @@
 block discarded – undo
20 20
 use Jaxon\App\Dialog\Library\ModalInterface;
21 21
 
22 22
 class JQueryConfirm extends AbstractLibrary
23
-    implements ModalInterface, AlertInterface, ConfirmInterface
23
+implements ModalInterface, AlertInterface, ConfirmInterface
24 24
 {
25
-    /**
25
+/**
26 26
      * @const The library name
27 27
      */
28
-    public const NAME = 'jconfirm';
28
+public const NAME = 'jconfirm';
29 29
 
30
-    /**
30
+/**
31 31
      * The css files
32 32
      *
33 33
      * @var array
34 34
      */
35
-    protected $aCssFiles = ['jquery-confirm.min.css'];
35
+protected $aCssFiles = ['jquery-confirm.min.css'];
36 36
 
37
-    /**
37
+/**
38 38
      * The js files
39 39
      *
40 40
      * @var array
41 41
      */
42
-    protected $aJsFiles = ['jquery-confirm.min.js'];
42
+protected $aJsFiles = ['jquery-confirm.min.js'];
43 43
 
44
-    /**
44
+/**
45 45
      * @inheritDoc
46 46
      */
47
-    public function getName(): string
48
-    {
49
-        return self::NAME;
50
-    }
47
+public function getName(): string
48
+{
49
+return self::NAME;
50
+}
51 51
 
52
-    /**
52
+/**
53 53
      * @inheritDoc
54 54
      */
55
-    public function getUri(): string
56
-    {
57
-        return 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
58
-    }
55
+public function getUri(): string
56
+{
57
+return 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
58
+}
59 59
 }
Please login to merge, or discard this patch.
jaxon-dialogs/src/Dialog/Library/Bootstrap3.php 1 patch
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -20,40 +20,40 @@
 block discarded – undo
20 20
 use Jaxon\App\Dialog\Library\ModalInterface;
21 21
 
22 22
 class Bootstrap3 extends AbstractLibrary
23
-    implements ModalInterface, AlertInterface, ConfirmInterface
23
+implements ModalInterface, AlertInterface, ConfirmInterface
24 24
 {
25
-    /**
25
+/**
26 26
      * @const The library name
27 27
      */
28
-    public const NAME = 'bootstrap3';
28
+public const NAME = 'bootstrap3';
29 29
 
30
-    /**
30
+/**
31 31
      * The css files
32 32
      *
33 33
      * @var array
34 34
      */
35
-    protected $aCssFiles = ['css/bootstrap-dialog.min.css'];
35
+protected $aCssFiles = ['css/bootstrap-dialog.min.css'];
36 36
 
37
-    /**
37
+/**
38 38
      * The js files
39 39
      *
40 40
      * @var array
41 41
      */
42
-    protected $aJsFiles = ['js/bootstrap-dialog.min.js'];
42
+protected $aJsFiles = ['js/bootstrap-dialog.min.js'];
43 43
 
44
-    /**
44
+/**
45 45
      * @inheritDoc
46 46
      */
47
-    public function getName(): string
48
-    {
49
-        return self::NAME;
50
-    }
47
+public function getName(): string
48
+{
49
+return self::NAME;
50
+}
51 51
 
52
-    /**
52
+/**
53 53
      * @inheritDoc
54 54
      */
55
-    public function getUri(): string
56
-    {
57
-        return 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
58
-    }
55
+public function getUri(): string
56
+{
57
+return 'https://cdn.jsdelivr.net/npm/[email protected]/dist';
58
+}
59 59
 }
Please login to merge, or discard this patch.
jaxon-dialogs/src/Dialog/LibraryHelper.php 2 patches
Switch Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -16,56 +16,56 @@  discard block
 block discarded – undo
16 16
 
17 17
 class LibraryHelper
18 18
 {
19
-    use ConfigTrait;
19
+use ConfigTrait;
20 20
 
21
-    /**
21
+/**
22 22
      * Default library URL
23 23
      *
24 24
      * @var string
25 25
      */
26
-    const JS_LIB_URL = 'https://cdn.jsdelivr.net/gh/jaxon-php/jaxon-dialogs@main/js';
26
+const JS_LIB_URL = 'https://cdn.jsdelivr.net/gh/jaxon-php/jaxon-dialogs@main/js';
27 27
 
28
-    /**
28
+/**
29 29
      * The name of the library
30 30
      *
31 31
      * @var string
32 32
      */
33
-    protected $sName = '';
33
+protected $sName = '';
34 34
 
35
-    /**
35
+/**
36 36
      * The URI where to get the library files from
37 37
      *
38 38
      * @var string
39 39
      */
40
-    protected $sUri = '';
40
+protected $sUri = '';
41 41
 
42
-    /**
42
+/**
43 43
      * The constructor
44 44
      *
45 45
      * @param LibraryInterface $xDialogLibrary
46 46
      * @param ConfigManager $xConfigManager
47 47
      * @param TemplateEngine $xTemplateEngine
48 48
      */
49
-    public function __construct(LibraryInterface $xDialogLibrary,
50
-        private ConfigManager $xConfigManager, private TemplateEngine $xTemplateEngine)
51
-    {
52
-        // Set the library name
53
-        $this->sName = $xDialogLibrary->getName();
54
-        // Set the default URI.
55
-        $sDefaultUri = $this->getAppOption('dialogs.lib.uri', $xDialogLibrary->getUri());
56
-        // Set the library URI.
57
-        $this->sUri = rtrim($this->getOption('uri', $sDefaultUri), '/');
58
-    }
59
-
60
-    /**
49
+public function __construct(LibraryInterface $xDialogLibrary,
50
+private ConfigManager $xConfigManager, private TemplateEngine $xTemplateEngine)
51
+{
52
+// Set the library name
53
+$this->sName = $xDialogLibrary->getName();
54
+// Set the default URI.
55
+$sDefaultUri = $this->getAppOption('dialogs.lib.uri', $xDialogLibrary->getUri());
56
+// Set the library URI.
57
+$this->sUri = rtrim($this->getOption('uri', $sDefaultUri), '/');
58
+}
59
+
60
+/**
61 61
      * @return ConfigManager
62 62
      */
63
-    protected function config(): ConfigManager
64
-    {
65
-        return $this->xConfigManager;
66
-    }
63
+protected function config(): ConfigManager
64
+{
65
+return $this->xConfigManager;
66
+}
67 67
 
68
-    /**
68
+/**
69 69
      * Get the value of a config option
70 70
      *
71 71
      * @param string $sOptionName The option name
@@ -73,134 +73,134 @@  discard block
 block discarded – undo
73 73
      *
74 74
      * @return mixed
75 75
      */
76
-    public function getOption(string $sOptionName, $xDefault = null)
77
-    {
78
-        $sOptionName = "dialogs.{$this->sName}.$sOptionName";
79
-        return $this->getAppOption($sOptionName, $xDefault);
80
-    }
76
+public function getOption(string $sOptionName, $xDefault = null)
77
+{
78
+$sOptionName = "dialogs.{$this->sName}.$sOptionName";
79
+return $this->getAppOption($sOptionName, $xDefault);
80
+}
81 81
 
82
-    /**
82
+/**
83 83
      * Check the presence of a config option
84 84
      *
85 85
      * @param string $sOptionName The option name
86 86
      *
87 87
      * @return bool
88 88
      */
89
-    public function hasOption(string $sOptionName): bool
90
-    {
91
-        return $this->hasAppOption("dialogs.{$this->sName}.$sOptionName");
92
-    }
89
+public function hasOption(string $sOptionName): bool
90
+{
91
+return $this->hasAppOption("dialogs.{$this->sName}.$sOptionName");
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Get the options of the js library
96 96
      *
97 97
      * @return array
98 98
      */
99
-    public function getJsOptions(): array
100
-    {
101
-        $xOptions = $this->getAppOption("dialogs.{$this->sName}.options", []);
102
-        return is_array($xOptions) ? $xOptions : [];
103
-    }
99
+public function getJsOptions(): array
100
+{
101
+$xOptions = $this->getAppOption("dialogs.{$this->sName}.options", []);
102
+return is_array($xOptions) ? $xOptions : [];
103
+}
104 104
 
105
-    /**
105
+/**
106 106
      * @param string $sOption The assets option name
107 107
      * @param string $sFile The javascript file name
108 108
      *
109 109
      * @return string|null
110 110
      */
111
-    private function getAssetUri(string $sOption, string $sFile): ?string
112
-    {
113
-        return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" :
114
-            (trim($this->getOption($sOption)) ?: null);
115
-    }
111
+private function getAssetUri(string $sOption, string $sFile): ?string
112
+{
113
+return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" :
114
+(trim($this->getOption($sOption)) ?: null);
115
+}
116 116
 
117
-    /**
117
+/**
118 118
      * @param string $sOption The assets option name
119 119
      * @param array $aFiles The asset files
120 120
      *
121 121
      * @return array
122 122
      */
123
-    private function getUris(string $sOption, array $aFiles): array
124
-    {
125
-        $aFiles = array_map(fn($sFile) =>
126
-            $this->getAssetUri($sOption, $sFile), $aFiles);
127
-        return array_filter($aFiles, fn($sFile) => $sFile !== null);
128
-    }
123
+private function getUris(string $sOption, array $aFiles): array
124
+{
125
+$aFiles = array_map(fn($sFile) =>
126
+$this->getAssetUri($sOption, $sFile), $aFiles);
127
+return array_filter($aFiles, fn($sFile) => $sFile !== null);
128
+}
129 129
 
130
-    /**
130
+/**
131 131
      * @param string $sUri
132 132
      *
133 133
      * @return string
134 134
      */
135
-    private function getJsTag(string $sUri): string
136
-    {
137
-        return '<script type="text/javascript" src="' . $sUri . '"></script>';
138
-    }
135
+private function getJsTag(string $sUri): string
136
+{
137
+return '<script type="text/javascript" src="' . $sUri . '"></script>';
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * Get the javascript HTML header code
142 142
      *
143 143
      * @param array $aFiles The js files
144 144
      *
145 145
      * @return string
146 146
      */
147
-    public function getJs(array $aFiles): string
148
-    {
149
-        $aFiles = $this->getUris('assets.js', $aFiles);
150
-        $aFiles = array_map(fn($sUri) => $this->getJsTag($sUri), $aFiles);
151
-        return implode("\n", $aFiles);
152
-    }
147
+public function getJs(array $aFiles): string
148
+{
149
+$aFiles = $this->getUris('assets.js', $aFiles);
150
+$aFiles = array_map(fn($sUri) => $this->getJsTag($sUri), $aFiles);
151
+return implode("\n", $aFiles);
152
+}
153 153
 
154
-    /**
154
+/**
155 155
      * @param string $sUri
156 156
      *
157 157
      * @return string
158 158
      */
159
-    private function getCssTag(string $sUri): string
160
-    {
161
-        return '<link rel="stylesheet" href="' . $sUri . '" />';
162
-    }
159
+private function getCssTag(string $sUri): string
160
+{
161
+return '<link rel="stylesheet" href="' . $sUri . '" />';
162
+}
163 163
 
164
-    /**
164
+/**
165 165
      * Get the CSS HTML header code
166 166
      *
167 167
      * @param array $aFiles The CSS files
168 168
      *
169 169
      * @return string
170 170
      */
171
-    public function getCss(array $aFiles): string
172
-    {
173
-        $aFiles = $this->getUris('assets.css', $aFiles);
174
-        $aFiles = array_map(fn($sUri) => $this->getCssTag($sUri), $aFiles);
175
-        return implode("\n", $aFiles);
176
-    }
171
+public function getCss(array $aFiles): string
172
+{
173
+$aFiles = $this->getUris('assets.css', $aFiles);
174
+$aFiles = array_map(fn($sUri) => $this->getCssTag($sUri), $aFiles);
175
+return implode("\n", $aFiles);
176
+}
177 177
 
178
-    /**
178
+/**
179 179
      * Get the library script code
180 180
      *
181 181
      * @return string
182 182
      */
183 183
 
184
-    public function getScript(): string
185
-    {
186
-        return !$this->getLibOption('js.app.export', false) ?
187
-            $this->xTemplateEngine->render("jaxon::dialogs::{$this->sName}.js") : '';
188
-    }
184
+public function getScript(): string
185
+{
186
+return !$this->getLibOption('js.app.export', false) ?
187
+$this->xTemplateEngine->render("jaxon::dialogs::{$this->sName}.js") : '';
188
+}
189 189
 
190
-    /**
190
+/**
191 191
      * Get the javascript HTML header code
192 192
      *
193 193
      * @return array
194 194
      */
195
-    public function getFiles(): array
196
-    {
197
-        if(!$this->getLibOption('js.app.export', false))
198
-        {
199
-            return [];
200
-        }
201
-
202
-        $sJsFileName = !$this->getLibOption('js.app.minify', false) ?
203
-            "{$this->sName}.js" : "{$this->sName}.min.js";
204
-        return [self::JS_LIB_URL . "/$sJsFileName"];
205
-    }
195
+public function getFiles(): array
196
+{
197
+if(!$this->getLibOption('js.app.export', false))
198
+{
199
+return [];
200
+}
201
+
202
+$sJsFileName = !$this->getLibOption('js.app.minify', false) ?
203
+"{$this->sName}.js" : "{$this->sName}.min.js";
204
+return [self::JS_LIB_URL . "/$sJsFileName"];
205
+}
206 206
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,8 +110,7 @@  discard block
 block discarded – undo
110 110
      */
111 111
     private function getAssetUri(string $sOption, string $sFile): ?string
112 112
     {
113
-        return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" :
114
-            (trim($this->getOption($sOption)) ?: null);
113
+        return !$this->hasOption($sOption) ? "{$this->sUri}/$sFile" : (trim($this->getOption($sOption)) ?: null);
115 114
     }
116 115
 
117 116
     /**
@@ -194,7 +193,7 @@  discard block
 block discarded – undo
194 193
      */
195 194
     public function getFiles(): array
196 195
     {
197
-        if(!$this->getLibOption('js.app.export', false))
196
+        if (!$this->getLibOption('js.app.export', false))
198 197
         {
199 198
             return [];
200 199
         }
Please login to merge, or discard this patch.
jaxon-dialogs/src/DialogManager.php 3 patches
Switch Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -36,44 +36,44 @@  discard block
 block discarded – undo
36 36
 
37 37
 class DialogManager implements ConfigListenerInterface, LibraryRegistryInterface
38 38
 {
39
-    /**
39
+/**
40 40
      * @var array
41 41
      */
42
-    protected $aLibraries = [];
42
+protected $aLibraries = [];
43 43
 
44
-    /**
44
+/**
45 45
      * The ConfirmInterface class name
46 46
      *
47 47
      * @var string
48 48
      */
49
-    private $sConfirmLibrary = '';
49
+private $sConfirmLibrary = '';
50 50
 
51
-    /**
51
+/**
52 52
      * The AlertInterface class name
53 53
      *
54 54
      * @var string
55 55
      */
56
-    private $sAlertLibrary = '';
56
+private $sAlertLibrary = '';
57 57
 
58
-    /**
58
+/**
59 59
      * The ModalInterface class name
60 60
      *
61 61
      * @var string
62 62
      */
63
-    private $sModalLibrary = '';
63
+private $sModalLibrary = '';
64 64
 
65
-    /**
65
+/**
66 66
      * The constructor
67 67
      *
68 68
      * @param Container $di
69 69
      * @param ConfigManager $xConfigManager
70 70
      * @param Translator $xTranslator
71 71
      */
72
-    public function __construct(private Container $di,
73
-        private ConfigManager $xConfigManager, private Translator $xTranslator)
74
-    {}
72
+public function __construct(private Container $di,
73
+private ConfigManager $xConfigManager, private Translator $xTranslator)
74
+{}
75 75
 
76
-    /**
76
+/**
77 77
      * Register a javascript dialog library adapter.
78 78
      *
79 79
      * @param string $sClass
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
      *
82 82
      * @return void
83 83
      */
84
-    private function _registerLibrary(string $sClass, string $sLibraryName): void
85
-    {
86
-        $this->di->set($sClass, function($di) use($sClass) {
87
-            return $di->make($sClass);
88
-        });
89
-        $this->di->set("dialog_library_helper_$sLibraryName", function($di) use($sClass) {
90
-            return new LibraryHelper($di->g($sClass), $di->g(ConfigManager::class),
91
-                $di->g(TemplateEngine::class));
92
-        });
93
-        // Set the alias, so the libraries can be found by their names.
94
-        $this->di->alias("dialog_library_$sLibraryName", $sClass);
95
-    }
84
+private function _registerLibrary(string $sClass, string $sLibraryName): void
85
+{
86
+$this->di->set($sClass, function($di) use($sClass) {
87
+return $di->make($sClass);
88
+});
89
+$this->di->set("dialog_library_helper_$sLibraryName", function($di) use($sClass) {
90
+return new LibraryHelper($di->g($sClass), $di->g(ConfigManager::class),
91
+    $di->g(TemplateEngine::class));
92
+});
93
+// Set the alias, so the libraries can be found by their names.
94
+$this->di->alias("dialog_library_$sLibraryName", $sClass);
95
+}
96 96
 
97
-    /**
97
+/**
98 98
      * Register a javascript dialog library adapter.
99 99
      *
100 100
      * @param string $sClassName
@@ -103,53 +103,53 @@  discard block
 block discarded – undo
103 103
      * @return void
104 104
      * @throws SetupException
105 105
      */
106
-    public function registerLibrary(string $sClassName, string $sLibraryName): void
107
-    {
108
-        if(isset($this->aLibraries[$sLibraryName]))
109
-        {
110
-            return;
111
-        }
112
-        if(!($aInterfaces = class_implements($sClassName)))
113
-        {
114
-            // The class is invalid.
115
-            $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
116
-            throw new SetupException($sMessage);
117
-        }
106
+public function registerLibrary(string $sClassName, string $sLibraryName): void
107
+{
108
+if(isset($this->aLibraries[$sLibraryName]))
109
+{
110
+return;
111
+}
112
+if(!($aInterfaces = class_implements($sClassName)))
113
+{
114
+// The class is invalid.
115
+$sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
116
+throw new SetupException($sMessage);
117
+}
118 118
 
119
-        $bIsConfirm = in_array(ConfirmInterface::class, $aInterfaces);
120
-        $bIsAlert = in_array(AlertInterface::class, $aInterfaces);
121
-        $bIsModal = in_array(ModalInterface::class, $aInterfaces);
122
-        if(!$bIsConfirm && !$bIsAlert && !$bIsModal)
123
-        {
124
-            // The class is invalid.
125
-            $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
126
-            throw new SetupException($sMessage);
127
-        }
119
+$bIsConfirm = in_array(ConfirmInterface::class, $aInterfaces);
120
+$bIsAlert = in_array(AlertInterface::class, $aInterfaces);
121
+$bIsModal = in_array(ModalInterface::class, $aInterfaces);
122
+if(!$bIsConfirm && !$bIsAlert && !$bIsModal)
123
+{
124
+// The class is invalid.
125
+$sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
126
+throw new SetupException($sMessage);
127
+}
128 128
 
129
-        // Save the library
130
-        $this->aLibraries[$sLibraryName] = [
131
-            'confirm' => $bIsConfirm,
132
-            'alert' => $bIsAlert,
133
-            'modal' => $bIsModal,
134
-            'used' => false,
135
-        ];
136
-        // Register the library class in the container
137
-        $this->_registerLibrary($sClassName, $sLibraryName);
138
-    }
129
+// Save the library
130
+$this->aLibraries[$sLibraryName] = [
131
+'confirm' => $bIsConfirm,
132
+'alert' => $bIsAlert,
133
+'modal' => $bIsModal,
134
+'used' => false,
135
+];
136
+// Register the library class in the container
137
+$this->_registerLibrary($sClassName, $sLibraryName);
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * Get the dialog library helper
142 142
      *
143 143
      * @param string $sLibraryName
144 144
      *
145 145
      * @return LibraryHelper
146 146
      */
147
-    public function getLibraryHelper(string $sLibraryName): LibraryHelper
148
-    {
149
-        return $this->di->g("dialog_library_helper_$sLibraryName");
150
-    }
147
+public function getLibraryHelper(string $sLibraryName): LibraryHelper
148
+{
149
+return $this->di->g("dialog_library_helper_$sLibraryName");
150
+}
151 151
 
152
-    /**
152
+/**
153 153
      * Set the ConfirmInterface library
154 154
      *
155 155
      * @param string $sLibraryName The ConfirmInterface library name
@@ -157,29 +157,29 @@  discard block
 block discarded – undo
157 157
      * @return void
158 158
      * @throws SetupException
159 159
      */
160
-    public function setConfirmLibrary(string $sLibraryName)
161
-    {
162
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['confirm'])
163
-        {
164
-            $sMessage = $this->xTranslator->trans('errors.dialog.library',
165
-                ['type' => 'confirm', 'name' => $sLibraryName]);
166
-            throw new SetupException($sMessage);
167
-        }
168
-        $this->sConfirmLibrary = $sLibraryName;
169
-    }
160
+public function setConfirmLibrary(string $sLibraryName)
161
+{
162
+if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['confirm'])
163
+{
164
+$sMessage = $this->xTranslator->trans('errors.dialog.library',
165
+    ['type' => 'confirm', 'name' => $sLibraryName]);
166
+throw new SetupException($sMessage);
167
+}
168
+$this->sConfirmLibrary = $sLibraryName;
169
+}
170 170
 
171
-    /**
171
+/**
172 172
      * Get the ConfirmInterface library
173 173
      *
174 174
      * @return ConfirmInterface
175 175
      */
176
-    public function getConfirmLibrary(): ConfirmInterface
177
-    {
178
-        $sKey = "dialog_library_{$this->sConfirmLibrary}";
179
-        return $this->di->h($sKey) ? $this->di->g($sKey) : $this->di->g(Alert::class);
180
-    }
176
+public function getConfirmLibrary(): ConfirmInterface
177
+{
178
+$sKey = "dialog_library_{$this->sConfirmLibrary}";
179
+return $this->di->h($sKey) ? $this->di->g($sKey) : $this->di->g(Alert::class);
180
+}
181 181
 
182
-    /**
182
+/**
183 183
      * Set AlertInterface library
184 184
      *
185 185
      * @param string $sLibraryName The AlertInterface library name
@@ -187,29 +187,29 @@  discard block
 block discarded – undo
187 187
      * @return void
188 188
      * @throws SetupException
189 189
      */
190
-    public function setAlertLibrary(string $sLibraryName): void
191
-    {
192
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['alert'])
193
-        {
194
-            $sMessage = $this->xTranslator->trans('errors.dialog.library',
195
-                ['type' => 'alert', 'name' => $sLibraryName]);
196
-            throw new SetupException($sMessage);
197
-        }
198
-        $this->sAlertLibrary = $sLibraryName;
199
-    }
190
+public function setAlertLibrary(string $sLibraryName): void
191
+{
192
+if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['alert'])
193
+{
194
+$sMessage = $this->xTranslator->trans('errors.dialog.library',
195
+    ['type' => 'alert', 'name' => $sLibraryName]);
196
+throw new SetupException($sMessage);
197
+}
198
+$this->sAlertLibrary = $sLibraryName;
199
+}
200 200
 
201
-    /**
201
+/**
202 202
      * Get the AlertInterface library
203 203
      *
204 204
      * @return AlertInterface
205 205
      */
206
-    public function getAlertLibrary(): AlertInterface
207
-    {
208
-        $sKey = "dialog_library_{$this->sAlertLibrary}";
209
-        return $this->di->h($sKey) ? $this->di->g($sKey) : $this->di->g(Alert::class);
210
-    }
206
+public function getAlertLibrary(): AlertInterface
207
+{
208
+$sKey = "dialog_library_{$this->sAlertLibrary}";
209
+return $this->di->h($sKey) ? $this->di->g($sKey) : $this->di->g(Alert::class);
210
+}
211 211
 
212
-    /**
212
+/**
213 213
      * Set the ModalInterface library
214 214
      *
215 215
      * @param string $sLibraryName The ModalInterface library name
@@ -217,137 +217,137 @@  discard block
 block discarded – undo
217 217
      * @return void
218 218
      * @throws SetupException
219 219
      */
220
-    public function setModalLibrary(string $sLibraryName): void
221
-    {
222
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
223
-        {
224
-            $sMessage = $this->xTranslator->trans('errors.dialog.library',
225
-                ['type' => 'modal', 'name' => $sLibraryName]);
226
-            throw new SetupException($sMessage);
227
-        }
228
-        $this->sModalLibrary = $sLibraryName;
229
-    }
220
+public function setModalLibrary(string $sLibraryName): void
221
+{
222
+if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
223
+{
224
+$sMessage = $this->xTranslator->trans('errors.dialog.library',
225
+    ['type' => 'modal', 'name' => $sLibraryName]);
226
+throw new SetupException($sMessage);
227
+}
228
+$this->sModalLibrary = $sLibraryName;
229
+}
230 230
 
231
-    /**
231
+/**
232 232
      * Get the ModalInterface library
233 233
      *
234 234
      * @return ModalInterface|null
235 235
      */
236
-    public function getModalLibrary(): ?ModalInterface
237
-    {
238
-        $sKey = "dialog_library_{$this->sModalLibrary}";
239
-        return $this->di->h($sKey) ? $this->di->g($sKey) : null;
240
-    }
236
+public function getModalLibrary(): ?ModalInterface
237
+{
238
+$sKey = "dialog_library_{$this->sModalLibrary}";
239
+return $this->di->h($sKey) ? $this->di->g($sKey) : null;
240
+}
241 241
 
242
-    /**
242
+/**
243 243
      * Register the javascript dialog libraries from config options.
244 244
      *
245 245
      * @return void
246 246
      * @throws SetupException
247 247
      */
248
-    protected function registerLibraries(): void
249
-    {
250
-        $aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.ext', []);
251
-        foreach($aLibraries as $sLibraryName => $sClassName)
252
-        {
253
-            $this->registerLibrary($sClassName, $sLibraryName);
254
-        }
255
-    }
248
+protected function registerLibraries(): void
249
+{
250
+$aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.ext', []);
251
+foreach($aLibraries as $sLibraryName => $sClassName)
252
+{
253
+$this->registerLibrary($sClassName, $sLibraryName);
254
+}
255
+}
256 256
 
257
-    /**
257
+/**
258 258
      * Set the default library for each dialog feature.
259 259
      *
260 260
      * @return void
261 261
      * @throws SetupException
262 262
      */
263
-    protected function setDefaultLibraries(): void
264
-    {
265
-        // Set the default modal library
266
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.modal', '')))
267
-        {
268
-            $this->setModalLibrary($sLibraryName);
269
-            $this->aLibraries[$sLibraryName]['used'] = true;
270
-        }
271
-        // Set the default alert library
272
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.alert', '')))
273
-        {
274
-            $this->setAlertLibrary($sLibraryName);
275
-            $this->aLibraries[$sLibraryName]['used'] = true;
276
-        }
277
-        // Set the default confirm library
278
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.confirm', '')))
279
-        {
280
-            $this->setConfirmLibrary($sLibraryName);
281
-            $this->aLibraries[$sLibraryName]['used'] = true;
282
-        }
283
-    }
263
+protected function setDefaultLibraries(): void
264
+{
265
+// Set the default modal library
266
+if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.modal', '')))
267
+{
268
+$this->setModalLibrary($sLibraryName);
269
+$this->aLibraries[$sLibraryName]['used'] = true;
270
+}
271
+// Set the default alert library
272
+if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.alert', '')))
273
+{
274
+$this->setAlertLibrary($sLibraryName);
275
+$this->aLibraries[$sLibraryName]['used'] = true;
276
+}
277
+// Set the default confirm library
278
+if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.confirm', '')))
279
+{
280
+$this->setConfirmLibrary($sLibraryName);
281
+$this->aLibraries[$sLibraryName]['used'] = true;
282
+}
283
+}
284 284
 
285
-    /**
285
+/**
286 286
      * Set the libraries in use.
287 287
      *
288 288
      * @return void
289 289
      */
290
-    protected function setUsedLibraries(): void
291
-    {
292
-        // Set the other libraries in use
293
-        $aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.use', []);
294
-        foreach($aLibraries as $sLibraryName)
295
-        {
296
-            if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
297
-            {
298
-                $this->aLibraries[$sLibraryName]['used'] = true;
299
-            }
300
-        }
301
-    }
290
+protected function setUsedLibraries(): void
291
+{
292
+// Set the other libraries in use
293
+$aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.use', []);
294
+foreach($aLibraries as $sLibraryName)
295
+{
296
+if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
297
+{
298
+    $this->aLibraries[$sLibraryName]['used'] = true;
299
+}
300
+}
301
+}
302 302
 
303
-    /**
303
+/**
304 304
      * Get the dialog libraries class instances
305 305
      *
306 306
      * @return LibraryInterface[]
307 307
      */
308
-    public function getLibraries(): array
309
-    {
310
-        // Reset the default libraries any time the config is changed.
311
-        $this->registerLibraries();
312
-        $this->setDefaultLibraries();
313
-        $this->setUsedLibraries();
308
+public function getLibraries(): array
309
+{
310
+// Reset the default libraries any time the config is changed.
311
+$this->registerLibraries();
312
+$this->setDefaultLibraries();
313
+$this->setUsedLibraries();
314 314
 
315
-        // Only return the libraries that are used.
316
-        $aLibraries = array_filter($this->aLibraries, function($aLibrary) {
317
-            return $aLibrary['used'];
318
-        });
319
-        return array_map(function($sLibraryName) {
320
-            return $this->di->g("dialog_library_$sLibraryName");
321
-        }, array_keys($aLibraries));
322
-    }
315
+// Only return the libraries that are used.
316
+$aLibraries = array_filter($this->aLibraries, function($aLibrary) {
317
+return $aLibrary['used'];
318
+});
319
+return array_map(function($sLibraryName) {
320
+return $this->di->g("dialog_library_$sLibraryName");
321
+}, array_keys($aLibraries));
322
+}
323 323
 
324
-    /**
324
+/**
325 325
      * @inheritDoc
326 326
      * @throws SetupException
327 327
      */
328
-    public function onChange(Config $xConfig, string $sName): void
329
-    {
330
-        if($sName === '')
331
-        {
332
-            // Reset the default libraries any time the config is changed.
333
-            $this->registerLibraries();
334
-            $this->setDefaultLibraries();
335
-            $this->setUsedLibraries();
336
-            return;
337
-        }
338
-        $sPrefix = substr($sName, 0, 15);
339
-        switch($sPrefix)
340
-        {
341
-        case 'dialogs.default':
342
-            $this->setDefaultLibraries();
343
-            return;
344
-        case 'dialogs.lib.ext':
345
-            $this->registerLibraries();
346
-            return;
347
-        case 'dialogs.lib.use':
348
-            $this->setUsedLibraries();
349
-            return;
350
-        default:
351
-        }
328
+public function onChange(Config $xConfig, string $sName): void
329
+{
330
+if($sName === '')
331
+{
332
+// Reset the default libraries any time the config is changed.
333
+$this->registerLibraries();
334
+$this->setDefaultLibraries();
335
+$this->setUsedLibraries();
336
+return;
337
+}
338
+$sPrefix = substr($sName, 0, 15);
339
+switch($sPrefix)
340
+{
341
+case 'dialogs.default':
342
+$this->setDefaultLibraries();
343
+return;
344
+case 'dialogs.lib.ext':
345
+$this->registerLibraries();
346
+return;
347
+case 'dialogs.lib.use':
348
+$this->setUsedLibraries();
349
+return;
350
+default:
351
+}
352 352
     }
353 353
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function registerLibrary(string $sClassName, string $sLibraryName): void
107 107
     {
108
-        if(isset($this->aLibraries[$sLibraryName]))
108
+        if (isset($this->aLibraries[$sLibraryName]))
109 109
         {
110 110
             return;
111 111
         }
112
-        if(!($aInterfaces = class_implements($sClassName)))
112
+        if (!($aInterfaces = class_implements($sClassName)))
113 113
         {
114 114
             // The class is invalid.
115 115
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
         $bIsConfirm = in_array(ConfirmInterface::class, $aInterfaces);
120 120
         $bIsAlert = in_array(AlertInterface::class, $aInterfaces);
121 121
         $bIsModal = in_array(ModalInterface::class, $aInterfaces);
122
-        if(!$bIsConfirm && !$bIsAlert && !$bIsModal)
122
+        if (!$bIsConfirm && !$bIsAlert && !$bIsModal)
123 123
         {
124 124
             // The class is invalid.
125 125
             $sMessage = $this->xTranslator->trans('errors.register.invalid', ['name' => $sClassName]);
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function setConfirmLibrary(string $sLibraryName)
161 161
     {
162
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['confirm'])
162
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['confirm'])
163 163
         {
164 164
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
165 165
                 ['type' => 'confirm', 'name' => $sLibraryName]);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
      */
190 190
     public function setAlertLibrary(string $sLibraryName): void
191 191
     {
192
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['alert'])
192
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['alert'])
193 193
         {
194 194
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
195 195
                 ['type' => 'alert', 'name' => $sLibraryName]);
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
      */
220 220
     public function setModalLibrary(string $sLibraryName): void
221 221
     {
222
-        if(!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
222
+        if (!isset($this->aLibraries[$sLibraryName]) || !$this->aLibraries[$sLibraryName]['modal'])
223 223
         {
224 224
             $sMessage = $this->xTranslator->trans('errors.dialog.library',
225 225
                 ['type' => 'modal', 'name' => $sLibraryName]);
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
     protected function registerLibraries(): void
249 249
     {
250 250
         $aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.ext', []);
251
-        foreach($aLibraries as $sLibraryName => $sClassName)
251
+        foreach ($aLibraries as $sLibraryName => $sClassName)
252 252
         {
253 253
             $this->registerLibrary($sClassName, $sLibraryName);
254 254
         }
@@ -263,19 +263,19 @@  discard block
 block discarded – undo
263 263
     protected function setDefaultLibraries(): void
264 264
     {
265 265
         // Set the default modal library
266
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.modal', '')))
266
+        if (($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.modal', '')))
267 267
         {
268 268
             $this->setModalLibrary($sLibraryName);
269 269
             $this->aLibraries[$sLibraryName]['used'] = true;
270 270
         }
271 271
         // Set the default alert library
272
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.alert', '')))
272
+        if (($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.alert', '')))
273 273
         {
274 274
             $this->setAlertLibrary($sLibraryName);
275 275
             $this->aLibraries[$sLibraryName]['used'] = true;
276 276
         }
277 277
         // Set the default confirm library
278
-        if(($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.confirm', '')))
278
+        if (($sLibraryName = $this->xConfigManager->getAppOption('dialogs.default.confirm', '')))
279 279
         {
280 280
             $this->setConfirmLibrary($sLibraryName);
281 281
             $this->aLibraries[$sLibraryName]['used'] = true;
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
     {
292 292
         // Set the other libraries in use
293 293
         $aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.use', []);
294
-        foreach($aLibraries as $sLibraryName)
294
+        foreach ($aLibraries as $sLibraryName)
295 295
         {
296
-            if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
296
+            if (isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
297 297
             {
298 298
                 $this->aLibraries[$sLibraryName]['used'] = true;
299 299
             }
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
      */
328 328
     public function onChange(Config $xConfig, string $sName): void
329 329
     {
330
-        if($sName === '')
330
+        if ($sName === '')
331 331
         {
332 332
             // Reset the default libraries any time the config is changed.
333 333
             $this->registerLibraries();
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
             return;
337 337
         }
338 338
         $sPrefix = substr($sName, 0, 15);
339
-        switch($sPrefix)
339
+        switch ($sPrefix)
340 340
         {
341 341
         case 'dialogs.default':
342 342
             $this->setDefaultLibraries();
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -293,10 +293,12 @@
 block discarded – undo
293 293
         $aLibraries = $this->xConfigManager->getAppOption('dialogs.lib.use', []);
294 294
         foreach($aLibraries as $sLibraryName)
295 295
         {
296
-            if(isset($this->aLibraries[$sLibraryName])) // Make sure the library exists
296
+            if(isset($this->aLibraries[$sLibraryName])) {
297
+                // Make sure the library exists
297 298
             {
298 299
                 $this->aLibraries[$sLibraryName]['used'] = true;
299 300
             }
301
+            }
300 302
         }
301 303
     }
302 304
 
Please login to merge, or discard this patch.
jaxon-flot/src/Data/Ticks.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     public function point($iXaxis, $sLabel): static
55 55
     {
56 56
         $this->aPoints[] = $iXaxis;
57
-        if(!$this->aLabels['data'])
57
+        if (!$this->aLabels['data'])
58 58
         {
59 59
             $this->aLabels['data'] = [];
60 60
         }
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function points($aPoints): int
73 73
     {
74
-        foreach($aPoints as $aPoint)
74
+        foreach ($aPoints as $aPoint)
75 75
         {
76
-            if(count($aPoint) == 2)
76
+            if (count($aPoint) == 2)
77 77
             {
78 78
                 $this->point($aPoint[0], $aPoint[1]);
79 79
             }
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
      */
97 97
     public function expr($iStart, $iEnd, $iStep, $sJsLabel): int
98 98
     {
99
-        for($x = $iStart; $x < $iEnd; $x += $iStep)
99
+        for ($x = $iStart; $x < $iEnd; $x += $iStep)
100 100
         {
101 101
             $this->aPoints[] = $x;
102 102
         }
103
-        if(($sJsLabel))
103
+        if (($sJsLabel))
104 104
         {
105 105
             $this->aLabels['func'] = $sJsLabel;
106 106
         }
Please login to merge, or discard this patch.
jaxon-flot/src/Data/Series.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
     public function point($iXaxis, $xValue, $sLabel = ''): static
62 62
     {
63 63
         $this->aPoints[] = $iXaxis;
64
-        if(!$this->aValues['data'])
64
+        if (!$this->aValues['data'])
65 65
         {
66 66
             $this->aValues['data'] = [];
67 67
         }
68 68
         $this->aValues['data'][$iXaxis] = $xValue;
69
-        if(($sLabel))
69
+        if (($sLabel))
70 70
         {
71
-            if(!$this->aLabels['data'])
71
+            if (!$this->aLabels['data'])
72 72
             {
73 73
                 $this->aLabels['data'] = [];
74 74
             }
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function points($aPoints): int
88 88
     {
89
-        foreach($aPoints as $aPoint)
89
+        foreach ($aPoints as $aPoint)
90 90
         {
91
-            if(count($aPoint) === 2)
91
+            if (count($aPoint) === 2)
92 92
             {
93 93
                 $this->point($aPoint[0], $aPoint[1]);
94 94
             }
95
-            else if(count($aPoint) === 3)
95
+            else if (count($aPoint) === 3)
96 96
             {
97 97
                 $this->point($aPoint[0], $aPoint[1], $aPoint[2]);
98 98
             }
@@ -118,12 +118,12 @@  discard block
 block discarded – undo
118 118
      */
119 119
     public function expr($iStart, $iEnd, $iStep, $sJsValue, $sJsLabel = ''): int
120 120
     {
121
-        for($x = $iStart; $x < $iEnd; $x += $iStep)
121
+        for ($x = $iStart; $x < $iEnd; $x += $iStep)
122 122
         {
123 123
             $this->aPoints[] = $x;
124 124
         }
125 125
         $this->aValues['func'] = $sJsValue;
126
-        if(($sJsLabel))
126
+        if (($sJsLabel))
127 127
         {
128 128
             $this->aLabels['func'] = $sJsLabel;
129 129
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,8 +91,7 @@
 block discarded – undo
91 91
             if(count($aPoint) === 2)
92 92
             {
93 93
                 $this->point($aPoint[0], $aPoint[1]);
94
-            }
95
-            else if(count($aPoint) === 3)
94
+            } else if(count($aPoint) === 3)
96 95
             {
97 96
                 $this->point($aPoint[0], $aPoint[1], $aPoint[2]);
98 97
             }
Please login to merge, or discard this patch.
jaxon-flot/src/FlotPlugin.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function getScript(): string
77 77
     {
78
-        return $this->xConfigManager->getOption('js.app.export', false) ? '' :
79
-            $this->xTemplateEngine->render('jaxon::flot::flot.js');
78
+        return $this->xConfigManager->getOption('js.app.export', false) ? '' : $this->xTemplateEngine->render('jaxon::flot::flot.js');
80 79
     }
81 80
 
82 81
     /**
@@ -84,7 +83,7 @@  discard block
 block discarded – undo
84 83
      */
85 84
     public function getJsCode(): ?JsCode
86 85
     {
87
-        if(!$this->xConfigManager->getOption('js.app.export', false))
86
+        if (!$this->xConfigManager->getOption('js.app.export', false))
88 87
         {
89 88
             return null;
90 89
         }
Please login to merge, or discard this patch.
jaxon-examples/templates/component/pagination/wrapper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <nav><ul class="pagination"><?php
2
-    if(($this->prev))
2
+    if (($this->prev))
3 3
     {
4 4
         echo $this->prev;
5 5
     }
6
-    foreach($this->links as $link)
6
+    foreach ($this->links as $link)
7 7
     {
8 8
         echo $link;
9 9
     }
10
-    if(($this->next))
10
+    if (($this->next))
11 11
     {
12 12
         echo $this->next;
13 13
     }
Please login to merge, or discard this patch.