Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-core/src/Plugin/AbstractPackage.php 1 patch
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,46 +19,46 @@  discard block
 block discarded – undo
19 19
 
20 20
 abstract class AbstractPackage extends AbstractCodeGenerator
21 21
 {
22
-    /**
22
+/**
23 23
      * The configuration options of the package
24 24
      *
25 25
      * @var Config
26 26
      */
27
-    protected $xPkgConfig;
27
+protected $xPkgConfig;
28 28
 
29
-    /**
29
+/**
30 30
      * The view renderer
31 31
      *
32 32
      * @var ViewRenderer
33 33
      */
34
-    protected $xRenderer;
34
+protected $xRenderer;
35 35
 
36
-    /**
36
+/**
37 37
      * Get the path to the config file, or the config options in an array.
38 38
      *
39 39
      * @return string|array
40 40
      */
41
-    abstract public static function config(): string|array;
41
+abstract public static function config(): string|array;
42 42
 
43
-    /**
43
+/**
44 44
      * Get the package config object
45 45
      *
46 46
      * @return Config
47 47
      */
48
-    final public function getConfig(): Config
49
-    {
50
-        return $this->xPkgConfig;
51
-    }
48
+final public function getConfig(): Config
49
+{
50
+return $this->xPkgConfig;
51
+}
52 52
 
53
-    /**
53
+/**
54 54
      * This method is automatically called after the package instance is created and configured.
55 55
      *
56 56
      * @return void
57 57
      */
58
-    protected function init(): void
59
-    {}
58
+protected function init(): void
59
+{}
60 60
 
61
-    /**
61
+/**
62 62
      * Get the value of a given package option
63 63
      *
64 64
      * @param string $sOption    The option name
@@ -66,59 +66,59 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return mixed
68 68
      */
69
-    final public function getOption(string $sOption, $xDefault = null): mixed
70
-    {
71
-        return $this->xPkgConfig->getOption($sOption, $xDefault);
72
-    }
69
+final public function getOption(string $sOption, $xDefault = null): mixed
70
+{
71
+return $this->xPkgConfig->getOption($sOption, $xDefault);
72
+}
73 73
 
74
-    /**
74
+/**
75 75
      * Get the view renderer
76 76
      *
77 77
      * @return ViewRenderer
78 78
      */
79
-    final public function view(): ViewRenderer
80
-    {
81
-        return $this->xRenderer;
82
-    }
79
+final public function view(): ViewRenderer
80
+{
81
+return $this->xRenderer;
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * @inheritDoc
86 86
      */
87
-    final public function getHash(): string
88
-    {
89
-        // Packages do not generate hash on their own. So we make this method final.
90
-        return '';
91
-    }
87
+final public function getHash(): string
88
+{
89
+// Packages do not generate hash on their own. So we make this method final.
90
+return '';
91
+}
92 92
 
93
-    /**
93
+/**
94 94
      * Get the HTML code of the package home page
95 95
      *
96 96
      * @return string|Stringable
97 97
      */
98
-    public function getHtml(): string|Stringable
99
-    {
100
-        return '';
101
-    }
98
+public function getHtml(): string|Stringable
99
+{
100
+return '';
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * Get the HTML code of the package home page
105 105
      *
106 106
      * This method is an alias for getHtml().
107 107
      *
108 108
      * @return string|Stringable
109 109
      */
110
-    public function html(): string|Stringable
111
-    {
112
-        return $this->getHtml();
113
-    }
110
+public function html(): string|Stringable
111
+{
112
+return $this->getHtml();
113
+}
114 114
 
115
-    /**
115
+/**
116 116
      * Get the Js code of the ready() callback
117 117
      *
118 118
      * @return string|Stringable
119 119
      */
120
-    public function getReadyScript(): string|Stringable
121
-    {
122
-        return '';
123
-    }
120
+public function getReadyScript(): string|Stringable
121
+{
122
+return '';
123
+}
124 124
 }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/UploadManager.php 3 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -121,13 +121,13 @@  discard block
 block discarded – undo
121 121
         try
122 122
         {
123 123
             $xFilesystem->createDirectory($sUploadDir);
124
-            if(!$xFilesystem->directoryExists($sUploadDir))
124
+            if (!$xFilesystem->directoryExists($sUploadDir))
125 125
             {
126 126
                 throw new RequestException($this->xTranslator->trans('errors.upload.access'));
127 127
             }
128 128
             return $sUploadDir;
129 129
         }
130
-        catch(FilesystemException $e)
130
+        catch (FilesystemException $e)
131 131
         {
132 132
             $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
133 133
             throw new RequestException($this->xTranslator->trans('errors.upload.access'));
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         // Check the uploaded file validity
164 164
         $nErrorCode = $xHttpFile->getError();
165
-        if($nErrorCode !== UPLOAD_ERR_OK)
165
+        if ($nErrorCode !== UPLOAD_ERR_OK)
166 166
         {
167 167
             $this->xLogger->error('File upload error.', [
168 168
                 'code' => $nErrorCode,
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         // Filename without the extension. Needs to be sanitized.
178 178
         $sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME);
179
-        if($this->cNameSanitizer !== null)
179
+        if ($this->cNameSanitizer !== null)
180 180
         {
181 181
             $sName = (string)call_user_func($this->cNameSanitizer,
182 182
                 $sName, $sField, $this->sUploadFieldId);
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
         // Set the user file data
186 186
         $xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName);
187 187
         // Verify file validity (format, size)
188
-        if(!$this->xValidator->validateUploadedFile($sField, $xFile))
188
+        if (!$this->xValidator->validateUploadedFile($sField, $xFile))
189 189
         {
190 190
             throw new RequestException($this->xValidator->getErrorMessage());
191 191
         }
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 
210 210
         $aUserFiles = [];
211 211
         $aAllFiles = []; // A flat list of all uploaded files
212
-        foreach($aTempFiles as $sField => $aFiles)
212
+        foreach ($aTempFiles as $sField => $aFiles)
213 213
         {
214 214
             $aUserFiles[$sField] = [];
215 215
             // Get the path to the upload dir
216 216
             $sUploadDir = $this->getUploadDir($sField);
217
-            if(!is_array($aFiles))
217
+            if (!is_array($aFiles))
218 218
             {
219 219
                 $aFiles = [$aFiles];
220 220
             }
221
-            foreach($aFiles as $xHttpFile)
221
+            foreach ($aFiles as $xHttpFile)
222 222
             {
223 223
                 $aFile = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField);
224 224
                 $aUserFiles[$sField][] = $aFile['user'];
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
         // Copy the uploaded files from the temp dir to the user dir
230 230
         try
231 231
         {
232
-            foreach($aAllFiles as $aFiles)
232
+            foreach ($aAllFiles as $aFiles)
233 233
             {
234 234
                 $sPath = $aFiles['user']->path();
235 235
                 $xContent = $aFiles['temp']->getStream();
236 236
                 $aFiles['user']->filesystem()->write($sPath, $xContent);
237 237
             }
238 238
         }
239
-        catch(FilesystemException $e)
239
+        catch (FilesystemException $e)
240 240
         {
241 241
             $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
242 242
             throw new RequestException($this->xTranslator->trans('errors.upload.access'));
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,8 +126,7 @@  discard block
 block discarded – undo
126 126
                 throw new RequestException($this->xTranslator->trans('errors.upload.access'));
127 127
             }
128 128
             return $sUploadDir;
129
-        }
130
-        catch(FilesystemException $e)
129
+        } catch(FilesystemException $e)
131 130
         {
132 131
             $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
133 132
             throw new RequestException($this->xTranslator->trans('errors.upload.access'));
@@ -235,8 +234,7 @@  discard block
 block discarded – undo
235 234
                 $xContent = $aFiles['temp']->getStream();
236 235
                 $aFiles['user']->filesystem()->write($sPath, $xContent);
237 236
             }
238
-        }
239
-        catch(FilesystemException $e)
237
+        } catch(FilesystemException $e)
240 238
         {
241 239
             $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
242 240
             throw new RequestException($this->xTranslator->trans('errors.upload.access'));
Please login to merge, or discard this patch.
Switch Indentation   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
 
29 29
 class UploadManager
30 30
 {
31
-    /**
31
+/**
32 32
      * The id of the upload field in the form
33 33
      *
34 34
      * @var string
35 35
      */
36
-    protected $sUploadFieldId = '';
36
+protected $sUploadFieldId = '';
37 37
 
38
-    /**
38
+/**
39 39
      * A user defined function to transform uploaded file names
40 40
      *
41 41
      * @var Closure
42 42
      */
43
-    protected $cNameSanitizer = null;
43
+protected $cNameSanitizer = null;
44 44
 
45
-    /**
45
+/**
46 46
      * @var array
47 47
      */
48
-    private $errorMessages = [
49
-        0 => 'There is no error, the file uploaded with success',
50
-        1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
51
-        2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
52
-        3 => 'The uploaded file was only partially uploaded',
53
-        4 => 'No file was uploaded',
54
-        6 => 'Missing a temporary folder',
55
-        7 => 'Failed to write file to disk.',
56
-        8 => 'A PHP extension stopped the file upload.',
57
-    ];
58
-
59
-    /**
48
+private $errorMessages = [
49
+0 => 'There is no error, the file uploaded with success',
50
+1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini',
51
+2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
52
+3 => 'The uploaded file was only partially uploaded',
53
+4 => 'No file was uploaded',
54
+6 => 'Missing a temporary folder',
55
+7 => 'Failed to write file to disk.',
56
+8 => 'A PHP extension stopped the file upload.',
57
+];
58
+
59
+/**
60 60
      * The constructor
61 61
      *
62 62
      * @param LoggerInterface $xLogger
@@ -65,49 +65,49 @@  discard block
 block discarded – undo
65 65
      * @param FileStorage $xFileStorage
66 66
      * @param FileNameInterface $xFileName
67 67
      */
68
-    public function __construct(private LoggerInterface $xLogger,
69
-        private Validator $xValidator, private Translator $xTranslator,
70
-        private FileStorage $xFileStorage, private FileNameInterface $xFileName)
71
-    {
72
-        // This feature is not yet implemented
73
-        $this->setUploadFieldId('');
74
-    }
75
-
76
-    /**
68
+public function __construct(private LoggerInterface $xLogger,
69
+private Validator $xValidator, private Translator $xTranslator,
70
+private FileStorage $xFileStorage, private FileNameInterface $xFileName)
71
+{
72
+// This feature is not yet implemented
73
+$this->setUploadFieldId('');
74
+}
75
+
76
+/**
77 77
      * Generate a random name
78 78
      *
79 79
      * @return string
80 80
      */
81
-    protected function randomName(): string
82
-    {
83
-        return $this->xFileName->random(16);
84
-    }
81
+protected function randomName(): string
82
+{
83
+return $this->xFileName->random(16);
84
+}
85 85
 
86
-    /**
86
+/**
87 87
      * Set the id of the upload field in the form
88 88
      *
89 89
      * @param string $sUploadFieldId
90 90
      *
91 91
      * @return void
92 92
      */
93
-    public function setUploadFieldId(string $sUploadFieldId): void
94
-    {
95
-        $this->sUploadFieldId = $sUploadFieldId;
96
-    }
93
+public function setUploadFieldId(string $sUploadFieldId): void
94
+{
95
+$this->sUploadFieldId = $sUploadFieldId;
96
+}
97 97
 
98
-    /**
98
+/**
99 99
      * Filter uploaded file name
100 100
      *
101 101
      * @param Closure $cNameSanitizer    The closure which filters filenames
102 102
      *
103 103
      * @return void
104 104
      */
105
-    public function setNameSanitizer(Closure $cNameSanitizer): void
106
-    {
107
-        $this->cNameSanitizer = $cNameSanitizer;
108
-    }
105
+public function setNameSanitizer(Closure $cNameSanitizer): void
106
+{
107
+$this->cNameSanitizer = $cNameSanitizer;
108
+}
109 109
 
110
-    /**
110
+/**
111 111
      * Make sure the upload dir exists and is writable
112 112
      *
113 113
      * @param Filesystem $xFilesystem
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
      * @return string
117 117
      * @throws RequestException
118 118
      */
119
-    private function _makeUploadDir(Filesystem $xFilesystem, string $sUploadDir): string
120
-    {
121
-        try
122
-        {
123
-            $xFilesystem->createDirectory($sUploadDir);
124
-            if(!$xFilesystem->directoryExists($sUploadDir))
125
-            {
126
-                throw new RequestException($this->xTranslator->trans('errors.upload.access'));
127
-            }
128
-            return $sUploadDir;
129
-        }
130
-        catch(FilesystemException $e)
131
-        {
132
-            $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
133
-            throw new RequestException($this->xTranslator->trans('errors.upload.access'));
134
-        }
135
-    }
136
-
137
-    /**
119
+private function _makeUploadDir(Filesystem $xFilesystem, string $sUploadDir): string
120
+{
121
+try
122
+{
123
+$xFilesystem->createDirectory($sUploadDir);
124
+if(!$xFilesystem->directoryExists($sUploadDir))
125
+{
126
+    throw new RequestException($this->xTranslator->trans('errors.upload.access'));
127
+}
128
+return $sUploadDir;
129
+}
130
+catch(FilesystemException $e)
131
+{
132
+$this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
133
+throw new RequestException($this->xTranslator->trans('errors.upload.access'));
134
+}
135
+}
136
+
137
+/**
138 138
      * Get the path to the upload dir
139 139
      *
140 140
      * @param string $sField
@@ -142,13 +142,13 @@  discard block
 block discarded – undo
142 142
      * @return string
143 143
      * @throws RequestException
144 144
      */
145
-    private function getUploadDir(string $sField): string
146
-    {
147
-        $xFileSystem = $this->xFileStorage->filesystem($sField);
148
-        return $this->_makeUploadDir($xFileSystem, $this->randomName() . '/');
149
-    }
145
+private function getUploadDir(string $sField): string
146
+{
147
+$xFileSystem = $this->xFileStorage->filesystem($sField);
148
+return $this->_makeUploadDir($xFileSystem, $this->randomName() . '/');
149
+}
150 150
 
151
-    /**
151
+/**
152 152
      * Check uploaded files
153 153
      *
154 154
      * @param UploadedFile $xHttpFile
@@ -158,43 +158,43 @@  discard block
 block discarded – undo
158 158
      * @return array
159 159
      * @throws RequestException
160 160
      */
161
-    private function makeUploadedFile(UploadedFile $xHttpFile, string $sUploadDir, string $sField): array
162
-    {
163
-        // Check the uploaded file validity
164
-        $nErrorCode = $xHttpFile->getError();
165
-        if($nErrorCode !== UPLOAD_ERR_OK)
166
-        {
167
-            $this->xLogger->error('File upload error.', [
168
-                'code' => $nErrorCode,
169
-                'message' => $this->errorMessages[$nErrorCode],
170
-            ]);
171
-            $sMessage = $this->xTranslator->trans('errors.upload.failed', [
172
-                'name' => $sField,
173
-            ]);
174
-            throw new RequestException($sMessage);
175
-        }
176
-
177
-        // Filename without the extension. Needs to be sanitized.
178
-        $sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME);
179
-        if($this->cNameSanitizer !== null)
180
-        {
181
-            $sName = (string)call_user_func($this->cNameSanitizer,
182
-                $sName, $sField, $this->sUploadFieldId);
183
-        }
184
-
185
-        // Set the user file data
186
-        $xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName);
187
-        // Verify file validity (format, size)
188
-        if(!$this->xValidator->validateUploadedFile($sField, $xFile))
189
-        {
190
-            throw new RequestException($this->xValidator->getErrorMessage());
191
-        }
192
-
193
-        // All's right, save the file for copy.
194
-        return ['temp' => $xHttpFile, 'user' => $xFile];
195
-    }
196
-
197
-    /**
161
+private function makeUploadedFile(UploadedFile $xHttpFile, string $sUploadDir, string $sField): array
162
+{
163
+// Check the uploaded file validity
164
+$nErrorCode = $xHttpFile->getError();
165
+if($nErrorCode !== UPLOAD_ERR_OK)
166
+{
167
+$this->xLogger->error('File upload error.', [
168
+    'code' => $nErrorCode,
169
+    'message' => $this->errorMessages[$nErrorCode],
170
+]);
171
+$sMessage = $this->xTranslator->trans('errors.upload.failed', [
172
+    'name' => $sField,
173
+]);
174
+throw new RequestException($sMessage);
175
+}
176
+
177
+// Filename without the extension. Needs to be sanitized.
178
+$sName = pathinfo($xHttpFile->getClientFilename(), PATHINFO_FILENAME);
179
+if($this->cNameSanitizer !== null)
180
+{
181
+$sName = (string)call_user_func($this->cNameSanitizer,
182
+    $sName, $sField, $this->sUploadFieldId);
183
+}
184
+
185
+// Set the user file data
186
+$xFile = File::fromHttpFile($this->xFileStorage->filesystem($sField), $xHttpFile, $sUploadDir, $sName);
187
+// Verify file validity (format, size)
188
+if(!$this->xValidator->validateUploadedFile($sField, $xFile))
189
+{
190
+throw new RequestException($this->xValidator->getErrorMessage());
191
+}
192
+
193
+// All's right, save the file for copy.
194
+return ['temp' => $xHttpFile, 'user' => $xFile];
195
+}
196
+
197
+/**
198 198
      * Read uploaded files info from HTTP request data
199 199
      *
200 200
      * @param ServerRequestInterface $xRequest
@@ -202,46 +202,46 @@  discard block
 block discarded – undo
202 202
      * @return array
203 203
      * @throws RequestException
204 204
      */
205
-    public function readFromHttpData(ServerRequestInterface $xRequest): array
206
-    {
207
-        // Get the uploaded files
208
-        $aTempFiles = $xRequest->getUploadedFiles();
209
-
210
-        $aUserFiles = [];
211
-        $aAllFiles = []; // A flat list of all uploaded files
212
-        foreach($aTempFiles as $sField => $aFiles)
213
-        {
214
-            $aUserFiles[$sField] = [];
215
-            // Get the path to the upload dir
216
-            $sUploadDir = $this->getUploadDir($sField);
217
-            if(!is_array($aFiles))
218
-            {
219
-                $aFiles = [$aFiles];
220
-            }
221
-            foreach($aFiles as $xHttpFile)
222
-            {
223
-                $aFile = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField);
224
-                $aUserFiles[$sField][] = $aFile['user'];
225
-                $aAllFiles[] = $aFile;
226
-            }
227
-        }
228
-
229
-        // Copy the uploaded files from the temp dir to the user dir
230
-        try
231
-        {
232
-            foreach($aAllFiles as $aFiles)
233
-            {
234
-                $sPath = $aFiles['user']->path();
235
-                $xContent = $aFiles['temp']->getStream();
236
-                $aFiles['user']->filesystem()->write($sPath, $xContent);
237
-            }
238
-        }
239
-        catch(FilesystemException $e)
240
-        {
241
-            $this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
242
-            throw new RequestException($this->xTranslator->trans('errors.upload.access'));
243
-        }
244
-
245
-        return $aUserFiles;
246
-    }
205
+public function readFromHttpData(ServerRequestInterface $xRequest): array
206
+{
207
+// Get the uploaded files
208
+$aTempFiles = $xRequest->getUploadedFiles();
209
+
210
+$aUserFiles = [];
211
+$aAllFiles = []; // A flat list of all uploaded files
212
+foreach($aTempFiles as $sField => $aFiles)
213
+{
214
+$aUserFiles[$sField] = [];
215
+// Get the path to the upload dir
216
+$sUploadDir = $this->getUploadDir($sField);
217
+if(!is_array($aFiles))
218
+{
219
+    $aFiles = [$aFiles];
220
+}
221
+foreach($aFiles as $xHttpFile)
222
+{
223
+    $aFile = $this->makeUploadedFile($xHttpFile, $sUploadDir, $sField);
224
+    $aUserFiles[$sField][] = $aFile['user'];
225
+    $aAllFiles[] = $aFile;
226
+}
227
+}
228
+
229
+// Copy the uploaded files from the temp dir to the user dir
230
+try
231
+{
232
+foreach($aAllFiles as $aFiles)
233
+{
234
+    $sPath = $aFiles['user']->path();
235
+    $xContent = $aFiles['temp']->getStream();
236
+    $aFiles['user']->filesystem()->write($sPath, $xContent);
237
+}
238
+}
239
+catch(FilesystemException $e)
240
+{
241
+$this->xLogger->error('Filesystem error.', ['message' => $e->getMessage()]);
242
+throw new RequestException($this->xTranslator->trans('errors.upload.access'));
243
+}
244
+
245
+return $aUserFiles;
246
+}
247 247
 }
Please login to merge, or discard this patch.
jaxon-core/src/Response/NodeResponse.php 1 patch
Switch Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -28,40 +28,40 @@  discard block
 block discarded – undo
28 28
 
29 29
 class NodeResponse extends AjaxResponse
30 30
 {
31
-    /**
31
+/**
32 32
      * @var array
33 33
      */
34
-    private $aComponent = [];
34
+private $aComponent = [];
35 35
 
36
-    /**
36
+/**
37 37
      * The constructor
38 38
      *
39 39
      * @param ResponseManager $xManager
40 40
      * @param PluginManager $xPluginManager
41 41
      * @param JxnCall $xJxnCall
42 42
      */
43
-    public function __construct(ResponseManager $xManager,
44
-        PluginManager $xPluginManager, JxnCall $xJxnCall)
45
-    {
46
-        parent::__construct($xManager, $xPluginManager);
47
-        // The js class name is also the component name.
48
-        $this->aComponent['name'] = $this->str($xJxnCall->_class());
49
-    }
43
+public function __construct(ResponseManager $xManager,
44
+PluginManager $xPluginManager, JxnCall $xJxnCall)
45
+{
46
+parent::__construct($xManager, $xPluginManager);
47
+// The js class name is also the component name.
48
+$this->aComponent['name'] = $this->str($xJxnCall->_class());
49
+}
50 50
 
51
-    /**
51
+/**
52 52
      * Set the component item
53 53
      *
54 54
      * @param string $sItem
55 55
      *
56 56
      * @return self
57 57
      */
58
-    public function item(string $sItem = 'main'): self
59
-    {
60
-        $this->aComponent['item'] = $this->str($sItem);
61
-        return $this;
62
-    }
58
+public function item(string $sItem = 'main'): self
59
+{
60
+$this->aComponent['item'] = $this->str($sItem);
61
+return $this;
62
+}
63 63
 
64
-    /**
64
+/**
65 65
      * Add a response command to the array of commands
66 66
      *
67 67
      * @param string $sName    The command name
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return Command
72 72
      */
73
-    public function addCommand(string $sName, array|JsonSerializable $aArgs = [],
74
-        bool $bRemoveEmpty = false): Command
75
-    {
76
-        return $this->xManager
77
-            ->addCommand($sName, $aArgs, $bRemoveEmpty)
78
-            ->setComponent($this->aComponent);
79
-    }
73
+public function addCommand(string $sName, array|JsonSerializable $aArgs = [],
74
+bool $bRemoveEmpty = false): Command
75
+{
76
+return $this->xManager
77
+->addCommand($sName, $aArgs, $bRemoveEmpty)
78
+->setComponent($this->aComponent);
79
+}
80 80
 
81
-    /**
81
+/**
82 82
      * Add a command to assign the specified value to the given element's attribute
83 83
      *
84 84
      * @param string $sAttribute    The attribute to be assigned
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return self
88 88
      */
89
-    public function assign(string $sAttribute, string $sValue): self
90
-    {
91
-        $this->addCommand('node.assign', [
92
-            'attr' => $this->str($sAttribute),
93
-            'value' => $this->str($sValue),
94
-        ]);
95
-        return $this;
96
-    }
89
+public function assign(string $sAttribute, string $sValue): self
90
+{
91
+$this->addCommand('node.assign', [
92
+'attr' => $this->str($sAttribute),
93
+'value' => $this->str($sValue),
94
+]);
95
+return $this;
96
+}
97 97
 
98
-    /**
98
+/**
99 99
      * Add a command to assign the specified HTML content to the given element
100 100
      *
101 101
      * This is a shortcut for assign() on the innerHTML attribute.
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
      *
105 105
      * @return self
106 106
      */
107
-    public function html(string $sValue): self
108
-    {
109
-        return $this->assign('innerHTML', $sValue);
110
-    }
107
+public function html(string $sValue): self
108
+{
109
+return $this->assign('innerHTML', $sValue);
110
+}
111 111
 
112
-    /**
112
+/**
113 113
      * Add a command to assign the specified value to the given CSS attribute
114 114
      *
115 115
      * @param string $sCssAttribute    The CSS attribute to be assigned
@@ -117,12 +117,12 @@  discard block
 block discarded – undo
117 117
      *
118 118
      * @return self
119 119
      */
120
-    public function style(string $sCssAttribute, string $sValue): self
121
-    {
122
-        return $this->assign("style.$sCssAttribute", $sValue);
123
-    }
120
+public function style(string $sCssAttribute, string $sValue): self
121
+{
122
+return $this->assign("style.$sCssAttribute", $sValue);
123
+}
124 124
 
125
-    /**
125
+/**
126 126
      * Add a command to append the specified data to the given element's attribute
127 127
      *
128 128
      * @param string $sAttribute    The name of the attribute to be appended to
@@ -130,16 +130,16 @@  discard block
 block discarded – undo
130 130
      *
131 131
      * @return self
132 132
      */
133
-    public function append(string $sAttribute, string $sValue): self
134
-    {
135
-        $this->addCommand('node.append', [
136
-            'attr' => $this->str($sAttribute),
137
-            'value' => $this->str($sValue),
138
-        ]);
139
-        return $this;
140
-    }
133
+public function append(string $sAttribute, string $sValue): self
134
+{
135
+$this->addCommand('node.append', [
136
+'attr' => $this->str($sAttribute),
137
+'value' => $this->str($sValue),
138
+]);
139
+return $this;
140
+}
141 141
 
142
-    /**
142
+/**
143 143
      * Add a command to prepend the specified data to the given element's attribute
144 144
      *
145 145
      * @param string $sAttribute    The name of the attribute to be prepended to
@@ -147,16 +147,16 @@  discard block
 block discarded – undo
147 147
      *
148 148
      * @return self
149 149
      */
150
-    public function prepend(string $sAttribute, string $sValue): self
151
-    {
152
-        $this->addCommand('node.prepend', [
153
-            'attr' => $this->str($sAttribute),
154
-            'value' => $this->str($sValue),
155
-        ]);
156
-        return $this;
157
-    }
150
+public function prepend(string $sAttribute, string $sValue): self
151
+{
152
+$this->addCommand('node.prepend', [
153
+'attr' => $this->str($sAttribute),
154
+'value' => $this->str($sValue),
155
+]);
156
+return $this;
157
+}
158 158
 
159
-    /**
159
+/**
160 160
      * Add a command to replace a specified value with another value within the given element's attribute
161 161
      *
162 162
      * @param string $sAttribute    The attribute to be updated
@@ -165,39 +165,39 @@  discard block
 block discarded – undo
165 165
      *
166 166
      * @return self
167 167
      */
168
-    public function replace(string $sAttribute, string $sSearch, string $sReplace): self
169
-    {
170
-        $this->addCommand('node.replace', [
171
-            'attr' => $this->str($sAttribute),
172
-            'search' => $this->str($sSearch),
173
-            'replace' => $this->str($sReplace),
174
-        ]);
175
-        return $this;
176
-    }
168
+public function replace(string $sAttribute, string $sSearch, string $sReplace): self
169
+{
170
+$this->addCommand('node.replace', [
171
+'attr' => $this->str($sAttribute),
172
+'search' => $this->str($sSearch),
173
+'replace' => $this->str($sReplace),
174
+]);
175
+return $this;
176
+}
177 177
 
178
-    /**
178
+/**
179 179
      * Add a command to clear the specified attribute of the given element
180 180
      *
181 181
      * @param string $sAttribute    The attribute to be cleared
182 182
      *
183 183
      * @return self
184 184
      */
185
-    public function clear(string $sAttribute = 'innerHTML'): self
186
-    {
187
-        $this->addCommand('node.clear', [
188
-            'attr' => $this->str($sAttribute),
189
-        ]);
190
-        return $this;
191
-    }
185
+public function clear(string $sAttribute = 'innerHTML'): self
186
+{
187
+$this->addCommand('node.clear', [
188
+'attr' => $this->str($sAttribute),
189
+]);
190
+return $this;
191
+}
192 192
 
193
-    /**
193
+/**
194 194
      * Add a command to remove an element from the document
195 195
      *
196 196
      * @return self
197 197
      */
198
-    public function remove(): self
199
-    {
200
-        $this->addCommand('node.remove', []);
201
-        return $this;
202
-    }
198
+public function remove(): self
199
+{
200
+$this->addCommand('node.remove', []);
201
+return $this;
202
+}
203 203
 }
Please login to merge, or discard this patch.
jaxon-core/src/Response/AjaxResponse.php 1 patch
Switch Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -41,52 +41,52 @@  discard block
 block discarded – undo
41 41
 
42 42
 abstract class AjaxResponse extends AbstractResponse
43 43
 {
44
-    /**
44
+/**
45 45
      * @inheritDoc
46 46
      */
47
-    public function getContentType(): string
48
-    {
49
-        return 'application/json';
50
-    }
47
+public function getContentType(): string
48
+{
49
+return 'application/json';
50
+}
51 51
 
52
-    /**
52
+/**
53 53
      * @inheritDoc
54 54
      */
55
-    public function getOutput(): string
56
-    {
57
-        return json_encode(['jxn' => ['commands' => $this->xManager->getCommands()]]);
58
-    }
55
+public function getOutput(): string
56
+{
57
+return json_encode(['jxn' => ['commands' => $this->xManager->getCommands()]]);
58
+}
59 59
 
60
-    /**
60
+/**
61 61
      * Add a command to call the specified javascript function with the given (optional) parameters
62 62
      *
63 63
      * @param string $sFunc    The name of the function to call
64 64
      *
65 65
      * @return self
66 66
      */
67
-    public function call(string $sFunc): self
68
-    {
69
-        $aArgs = func_get_args();
70
-        array_shift($aArgs);
71
-        $this->xManager->addCommand('script.exec.call',
72
-            ['func' => $this->str($sFunc), 'args' => $aArgs]);
73
-        return $this;
74
-    }
75
-
76
-    /**
67
+public function call(string $sFunc): self
68
+{
69
+$aArgs = func_get_args();
70
+array_shift($aArgs);
71
+$this->xManager->addCommand('script.exec.call',
72
+['func' => $this->str($sFunc), 'args' => $aArgs]);
73
+return $this;
74
+}
75
+
76
+/**
77 77
      * Add a command to execute the specified json expression
78 78
      *
79 79
      * @param JsExpr $xJsExpr    The json expression to execute
80 80
      *
81 81
      * @return self
82 82
      */
83
-    public function exec(JsExpr $xJsExpr): self
84
-    {
85
-        $this->xManager->addCommand('script.exec.expr', ['expr' => $xJsExpr]);
86
-        return $this;
87
-    }
83
+public function exec(JsExpr $xJsExpr): self
84
+{
85
+$this->xManager->addCommand('script.exec.expr', ['expr' => $xJsExpr]);
86
+return $this;
87
+}
88 88
 
89
-    /**
89
+/**
90 90
      * Response command that prompts user with [ok] [cancel] style message box
91 91
      *
92 92
      * The provided closure will be called with a response object as unique parameter.
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @return self
102 102
      */
103
-    public function confirm(Closure $fConfirm, string $sQuestion, array $aArgs = []): self
104
-    {
105
-        $this->xManager->addConfirmCommand('dialog.confirm',
106
-            fn() => $fConfirm($this), $sQuestion, $aArgs);
107
-        return $this;
108
-    }
109
-
110
-    /**
103
+public function confirm(Closure $fConfirm, string $sQuestion, array $aArgs = []): self
104
+{
105
+$this->xManager->addConfirmCommand('dialog.confirm',
106
+fn() => $fConfirm($this), $sQuestion, $aArgs);
107
+return $this;
108
+}
109
+
110
+/**
111 111
      * Add a command to display an alert message to the user
112 112
      *
113 113
      * @param string $sMessage    The message to be displayed
@@ -115,26 +115,26 @@  discard block
 block discarded – undo
115 115
      *
116 116
      * @return self
117 117
      */
118
-    public function alert(string $sMessage, array $aArgs = []): self
119
-    {
120
-        $this->xManager->addAlertCommand('dialog.alert.show', $sMessage, $aArgs);
121
-        return $this;
122
-    }
118
+public function alert(string $sMessage, array $aArgs = []): self
119
+{
120
+$this->xManager->addAlertCommand('dialog.alert.show', $sMessage, $aArgs);
121
+return $this;
122
+}
123 123
 
124
-    /**
124
+/**
125 125
      * Add a command to display a debug message to the user
126 126
      *
127 127
      * @param string $sMessage    The message to be displayed
128 128
      *
129 129
      * @return self
130 130
      */
131
-    public function debug(string $sMessage): self
132
-    {
133
-        $this->xManager->addCommand('script.debug', ['message' => $this->str($sMessage)]);
134
-        return $this;
135
-    }
131
+public function debug(string $sMessage): self
132
+{
133
+$this->xManager->addCommand('script.debug', ['message' => $this->str($sMessage)]);
134
+return $this;
135
+}
136 136
 
137
-    /**
137
+/**
138 138
      * Add a command to ask the browser to navigate to the specified URL
139 139
      *
140 140
      * @param string $sURL    The relative or fully qualified URL
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return self
144 144
      */
145
-    public function redirect(string $sURL, int $nDelay = 0): self
146
-    {
147
-        $this->xManager->addCommand('script.redirect', [
148
-            'delay' => $nDelay,
149
-            'url' => $this->xPluginManager->getParameterReader()->parseUrl($sURL),
150
-        ]);
151
-        return $this;
152
-    }
153
-
154
-    /**
145
+public function redirect(string $sURL, int $nDelay = 0): self
146
+{
147
+$this->xManager->addCommand('script.redirect', [
148
+'delay' => $nDelay,
149
+'url' => $this->xPluginManager->getParameterReader()->parseUrl($sURL),
150
+]);
151
+return $this;
152
+}
153
+
154
+/**
155 155
      * Add a command to make Jaxon to pause execution of the response commands,
156 156
      * returning control to the browser so it can perform other commands asynchronously.
157 157
      *
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
      *
162 162
      * @return self
163 163
      */
164
-    public function sleep(int $tenths): self
165
-    {
166
-        $this->xManager->addCommand('script.sleep', ['duration' => $tenths]);
167
-        return $this;
168
-    }
164
+public function sleep(int $tenths): self
165
+{
166
+$this->xManager->addCommand('script.sleep', ['duration' => $tenths]);
167
+return $this;
168
+}
169 169
 
170
-    /**
170
+/**
171 171
      * Create a JQuery selector expression, and link it to the current response.
172 172
      *
173 173
      * @param string $sPath    The jQuery selector path
@@ -175,48 +175,48 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @return JqSelectorCall
177 177
      */
178
-    public function jq(string $sPath = '', $xContext = null): JqSelectorCall
179
-    {
180
-        return $this->plugin(ScriptPlugin::class)->jq($sPath, $xContext);
181
-    }
178
+public function jq(string $sPath = '', $xContext = null): JqSelectorCall
179
+{
180
+return $this->plugin(ScriptPlugin::class)->jq($sPath, $xContext);
181
+}
182 182
 
183
-    /**
183
+/**
184 184
      * Create a Javascript object expression, and link it to the current response.
185 185
      *
186 186
      * @param string $sObject
187 187
      *
188 188
      * @return JsObjectCall
189 189
      */
190
-    public function jo(string $sObject = ''): JsObjectCall
191
-    {
192
-        return $this->plugin(ScriptPlugin::class)->jo($sObject);
193
-    }
190
+public function jo(string $sObject = ''): JsObjectCall
191
+{
192
+return $this->plugin(ScriptPlugin::class)->jo($sObject);
193
+}
194 194
 
195
-    /**
195
+/**
196 196
      * Create a Javascript element selector expression, and link it to the current response.
197 197
      *
198 198
      * @param string $sElementId
199 199
      *
200 200
      * @return JsSelectorCall
201 201
      */
202
-    public function je(string $sElementId = ''): JsSelectorCall
203
-    {
204
-        return $this->plugin(ScriptPlugin::class)->je($sElementId);
205
-    }
202
+public function je(string $sElementId = ''): JsSelectorCall
203
+{
204
+return $this->plugin(ScriptPlugin::class)->je($sElementId);
205
+}
206 206
 
207
-    /**
207
+/**
208 208
      * Get the databag with a given name
209 209
      *
210 210
      * @param string $sName
211 211
      *
212 212
      * @return DatabagContext
213 213
      */
214
-    public function bag(string $sName): DatabagContext
215
-    {
216
-        return $this->plugin(DatabagPlugin::class)->bag($sName);
217
-    }
214
+public function bag(string $sName): DatabagContext
215
+{
216
+return $this->plugin(DatabagPlugin::class)->bag($sName);
217
+}
218 218
 
219
-    /**
219
+/**
220 220
      * Render an HTML pagination control.
221 221
      *
222 222
      * @param int $nPageNumber     The current page number
@@ -225,19 +225,19 @@  discard block
 block discarded – undo
225 225
      *
226 226
      * @return Paginator
227 227
      */
228
-    public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator
229
-    {
230
-        return $this->plugin(PaginatorPlugin::class)
231
-            ->paginator($nPageNumber, $nItemsPerPage, $nTotalItems);
232
-    }
228
+public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator
229
+{
230
+return $this->plugin(PaginatorPlugin::class)
231
+->paginator($nPageNumber, $nItemsPerPage, $nTotalItems);
232
+}
233 233
 
234
-    /**
234
+/**
235 235
      * Convert this response to a PSR7 response object
236 236
      *
237 237
      * @return PsrResponseInterface
238 238
      */
239
-    public function toPsr(): PsrResponseInterface
240
-    {
241
-        return $this->plugin(PsrPlugin::class)->ajaxResponse();
242
-    }
239
+public function toPsr(): PsrResponseInterface
240
+{
241
+return $this->plugin(PsrPlugin::class)->ajaxResponse();
242
+}
243 243
 }
Please login to merge, or discard this patch.
jaxon-core/src/Response/Response.php 1 patch
Switch Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 class Response extends AjaxResponse
28 28
 {
29
-    /**
29
+/**
30 30
      * Add a command to assign the specified value to the given element's attribute
31 31
      *
32 32
      * @param string $sTarget    The id of the html element on the browser
@@ -35,17 +35,17 @@  discard block
 block discarded – undo
35 35
      *
36 36
      * @return self
37 37
      */
38
-    public function assign(string $sTarget, string $sAttribute, string $sValue): self
39
-    {
40
-        $this->xManager->addCommand('node.assign', [
41
-            'id' => $this->str($sTarget),
42
-            'attr' => $this->str($sAttribute),
43
-            'value' => $this->str($sValue),
44
-        ]);
45
-        return $this;
46
-    }
38
+public function assign(string $sTarget, string $sAttribute, string $sValue): self
39
+{
40
+$this->xManager->addCommand('node.assign', [
41
+'id' => $this->str($sTarget),
42
+'attr' => $this->str($sAttribute),
43
+'value' => $this->str($sValue),
44
+]);
45
+return $this;
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * Add a command to assign the specified HTML content to the given element
50 50
      *
51 51
      * This is a shortcut for assign() on the innerHTML attribute.
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return self
57 57
      */
58
-    public function html(string $sTarget, string $sValue): self
59
-    {
60
-        return $this->assign($sTarget, 'innerHTML', $sValue);
61
-    }
58
+public function html(string $sTarget, string $sValue): self
59
+{
60
+return $this->assign($sTarget, 'innerHTML', $sValue);
61
+}
62 62
 
63
-    /**
63
+/**
64 64
      * Add a command to assign the specified value to the given CSS attribute
65 65
      *
66 66
      * @param string $sTarget    The id of the html element on the browser
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
      *
70 70
      * @return self
71 71
      */
72
-    public function style(string $sTarget, string $sCssAttribute, string $sValue): self
73
-    {
74
-        return $this->assign($sTarget, "style.$sCssAttribute", $sValue);
75
-    }
72
+public function style(string $sTarget, string $sCssAttribute, string $sValue): self
73
+{
74
+return $this->assign($sTarget, "style.$sCssAttribute", $sValue);
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * Add a command to append the specified data to the given element's attribute
79 79
      *
80 80
      * @param string $sTarget    The id of the element to be updated
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
      *
84 84
      * @return self
85 85
      */
86
-    public function append(string $sTarget, string $sAttribute, string $sValue): self
87
-    {
88
-        $this->xManager->addCommand('node.append', [
89
-            'id' => $this->str($sTarget),
90
-            'attr' => $this->str($sAttribute),
91
-            'value' => $this->str($sValue),
92
-        ]);
93
-        return $this;
94
-    }
86
+public function append(string $sTarget, string $sAttribute, string $sValue): self
87
+{
88
+$this->xManager->addCommand('node.append', [
89
+'id' => $this->str($sTarget),
90
+'attr' => $this->str($sAttribute),
91
+'value' => $this->str($sValue),
92
+]);
93
+return $this;
94
+}
95 95
 
96
-    /**
96
+/**
97 97
      * Add a command to prepend the specified data to the given element's attribute
98 98
      *
99 99
      * @param string $sTarget    The id of the element to be updated
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
      *
103 103
      * @return self
104 104
      */
105
-    public function prepend(string $sTarget, string $sAttribute, string $sValue): self
106
-    {
107
-        $this->xManager->addCommand('node.prepend', [
108
-            'id' => $this->str($sTarget),
109
-            'attr' => $this->str($sAttribute),
110
-            'value' => $this->str($sValue),
111
-        ]);
112
-        return $this;
113
-    }
105
+public function prepend(string $sTarget, string $sAttribute, string $sValue): self
106
+{
107
+$this->xManager->addCommand('node.prepend', [
108
+'id' => $this->str($sTarget),
109
+'attr' => $this->str($sAttribute),
110
+'value' => $this->str($sValue),
111
+]);
112
+return $this;
113
+}
114 114
 
115
-    /**
115
+/**
116 116
      * Add a command to replace a specified value with another value within the given element's attribute
117 117
      *
118 118
      * @param string $sTarget    The id of the element to update
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return self
124 124
      */
125
-    public function replace(string $sTarget, string $sAttribute,
126
-        string $sSearch, string $sReplace): self
127
-    {
128
-        $this->xManager->addCommand('node.replace', [
129
-            'id' => $this->str($sTarget),
130
-            'attr' => $this->str($sAttribute),
131
-            'search' => $this->str($sSearch),
132
-            'replace' => $this->str($sReplace),
133
-        ]);
134
-        return $this;
135
-    }
125
+public function replace(string $sTarget, string $sAttribute,
126
+string $sSearch, string $sReplace): self
127
+{
128
+$this->xManager->addCommand('node.replace', [
129
+'id' => $this->str($sTarget),
130
+'attr' => $this->str($sAttribute),
131
+'search' => $this->str($sSearch),
132
+'replace' => $this->str($sReplace),
133
+]);
134
+return $this;
135
+}
136 136
 
137
-    /**
137
+/**
138 138
      * Add a command to clear the specified attribute of the given element
139 139
      *
140 140
      * @param string $sTarget    The id of the element to be updated.
@@ -142,31 +142,31 @@  discard block
 block discarded – undo
142 142
      *
143 143
      * @return self
144 144
      */
145
-    public function clear(string $sTarget, string $sAttribute = 'innerHTML'): self
146
-    {
147
-        $this->xManager->addCommand('node.clear', [
148
-            'id' => $this->str($sTarget),
149
-            'attr' => $this->str($sAttribute),
150
-        ]);
151
-        return $this;
152
-    }
145
+public function clear(string $sTarget, string $sAttribute = 'innerHTML'): self
146
+{
147
+$this->xManager->addCommand('node.clear', [
148
+'id' => $this->str($sTarget),
149
+'attr' => $this->str($sAttribute),
150
+]);
151
+return $this;
152
+}
153 153
 
154
-    /**
154
+/**
155 155
      * Add a command to remove an element from the document
156 156
      *
157 157
      * @param string $sTarget    The id of the element to be removed
158 158
      *
159 159
      * @return self
160 160
      */
161
-    public function remove(string $sTarget): self
162
-    {
163
-        $this->xManager->addCommand('node.remove', [
164
-            'id' => $this->str($sTarget),
165
-        ]);
166
-        return $this;
167
-    }
161
+public function remove(string $sTarget): self
162
+{
163
+$this->xManager->addCommand('node.remove', [
164
+'id' => $this->str($sTarget),
165
+]);
166
+return $this;
167
+}
168 168
 
169
-    /**
169
+/**
170 170
      * Add a command to bind an element to a component
171 171
      *
172 172
      * @param string $sTarget   The id of the element
@@ -175,21 +175,21 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @return self
177 177
      */
178
-    public function bind(string $sTarget, JxnCall $xCall, string $sItem = ''): self
179
-    {
180
-        $this->xManager->addCommand('node.bind', [
181
-            'id' => $this->str($sTarget),
182
-            'component' => !$sItem ? [
183
-                'name' => $xCall->_class(),
184
-            ] : [
185
-                'name' => $xCall->_class(),
186
-                'item' => $this->str($sItem),
187
-            ],
188
-        ]);
189
-        return $this;
190
-    }
178
+public function bind(string $sTarget, JxnCall $xCall, string $sItem = ''): self
179
+{
180
+$this->xManager->addCommand('node.bind', [
181
+'id' => $this->str($sTarget),
182
+'component' => !$sItem ? [
183
+    'name' => $xCall->_class(),
184
+] : [
185
+    'name' => $xCall->_class(),
186
+    'item' => $this->str($sItem),
187
+],
188
+]);
189
+return $this;
190
+}
191 191
 
192
-    /**
192
+/**
193 193
      * Add a command to create a new element on the browser
194 194
      * @deprecated DOM element creation functions are deprecated
195 195
      *
@@ -199,19 +199,19 @@  discard block
 block discarded – undo
199 199
      *
200 200
      * @return self
201 201
      */
202
-    public function create(string $sParent, string $sTag, string $sId): self
203
-    {
204
-        $this->xManager->addCommand('node.create', [
205
-            'id' => $this->str($sParent),
206
-            'tag' => [
207
-                'name' => $this->str($sTag),
208
-                'id' => $this->str($sId),
209
-            ],
210
-        ]);
211
-        return $this;
212
-    }
202
+public function create(string $sParent, string $sTag, string $sId): self
203
+{
204
+$this->xManager->addCommand('node.create', [
205
+'id' => $this->str($sParent),
206
+'tag' => [
207
+    'name' => $this->str($sTag),
208
+    'id' => $this->str($sId),
209
+],
210
+]);
211
+return $this;
212
+}
213 213
 
214
-    /**
214
+/**
215 215
      * Add a command to insert a new element just prior to the specified element
216 216
      * @deprecated DOM element creation functions are deprecated
217 217
      *
@@ -221,19 +221,19 @@  discard block
 block discarded – undo
221 221
      *
222 222
      * @return self
223 223
      */
224
-    public function insertBefore(string $sBefore, string $sTag, string $sId): self
225
-    {
226
-        $this->xManager->addCommand('node.insert.before', [
227
-            'id' => $this->str($sBefore),
228
-            'tag' => [
229
-                'name' => $this->str($sTag),
230
-                'id' => $this->str($sId),
231
-            ],
232
-        ]);
233
-        return $this;
234
-    }
224
+public function insertBefore(string $sBefore, string $sTag, string $sId): self
225
+{
226
+$this->xManager->addCommand('node.insert.before', [
227
+'id' => $this->str($sBefore),
228
+'tag' => [
229
+    'name' => $this->str($sTag),
230
+    'id' => $this->str($sId),
231
+],
232
+]);
233
+return $this;
234
+}
235 235
 
236
-    /**
236
+/**
237 237
      * Add a command to insert a new element just prior to the specified element
238 238
      * This is an alias for insertBefore.
239 239
      * @deprecated DOM element creation functions are deprecated
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
      *
245 245
      * @return self
246 246
      */
247
-    public function insert(string $sBefore, string $sTag, string $sId): self
248
-    {
249
-        return $this->insertBefore($sBefore, $sTag, $sId);
250
-    }
247
+public function insert(string $sBefore, string $sTag, string $sId): self
248
+{
249
+return $this->insertBefore($sBefore, $sTag, $sId);
250
+}
251 251
 
252
-    /**
252
+/**
253 253
      * Add a command to insert a new element after the specified
254 254
      * @deprecated DOM element creation functions are deprecated
255 255
      *
@@ -259,19 +259,19 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return self
261 261
      */
262
-    public function insertAfter(string $sAfter, string $sTag, string $sId): self
263
-    {
264
-        $this->xManager->addCommand('node.insert.after', [
265
-            'id' => $this->str($sAfter),
266
-            'tag' => [
267
-                'name' => $this->str($sTag),
268
-                'id' => $this->str($sId),
269
-            ],
270
-        ]);
271
-        return $this;
272
-    }
262
+public function insertAfter(string $sAfter, string $sTag, string $sId): self
263
+{
264
+$this->xManager->addCommand('node.insert.after', [
265
+'id' => $this->str($sAfter),
266
+'tag' => [
267
+    'name' => $this->str($sTag),
268
+    'id' => $this->str($sId),
269
+],
270
+]);
271
+return $this;
272
+}
273 273
 
274
-    /**
274
+/**
275 275
      * Add a command to set an event handler on the specified element
276 276
      * This handler can take custom parameters, and is is executed in a specific context.
277 277
      * @deprecated Event handler functions are deprecated
@@ -282,17 +282,17 @@  discard block
 block discarded – undo
282 282
      *
283 283
      * @return self
284 284
      */
285
-    public function setEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
286
-    {
287
-        $this->xManager->addCommand('handler.event.set', [
288
-            'id' => $this->str($sTarget),
289
-            'event' => $this->str($sEvent),
290
-            'func' => $xCall,
291
-        ]);
292
-        return $this;
293
-    }
285
+public function setEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
286
+{
287
+$this->xManager->addCommand('handler.event.set', [
288
+'id' => $this->str($sTarget),
289
+'event' => $this->str($sEvent),
290
+'func' => $xCall,
291
+]);
292
+return $this;
293
+}
294 294
 
295
-    /**
295
+/**
296 296
      * Add a command to set a click handler on the browser
297 297
      * @deprecated Event handler functions are deprecated
298 298
      *
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
      *
302 302
      * @return self
303 303
      */
304
-    public function onClick(string $sTarget, JsExpr $xCall): self
305
-    {
306
-        return $this->setEventHandler($sTarget, 'onclick', $xCall);
307
-    }
304
+public function onClick(string $sTarget, JsExpr $xCall): self
305
+{
306
+return $this->setEventHandler($sTarget, 'onclick', $xCall);
307
+}
308 308
 
309
-    /**
309
+/**
310 310
      * Add a command to add an event handler on the specified element
311 311
      * This handler can take custom parameters, and is is executed in a specific context.
312 312
      * @deprecated Event handler functions are deprecated
@@ -317,17 +317,17 @@  discard block
 block discarded – undo
317 317
      *
318 318
      * @return self
319 319
      */
320
-    public function addEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
321
-    {
322
-        $this->xManager->addCommand('handler.event.add', [
323
-            'id' => $this->str($sTarget),
324
-            'event' => $this->str($sEvent),
325
-            'func' => $xCall,
326
-        ]);
327
-        return $this;
328
-    }
320
+public function addEventHandler(string $sTarget, string $sEvent, JsExpr $xCall): self
321
+{
322
+$this->xManager->addCommand('handler.event.add', [
323
+'id' => $this->str($sTarget),
324
+'event' => $this->str($sEvent),
325
+'func' => $xCall,
326
+]);
327
+return $this;
328
+}
329 329
 
330
-    /**
330
+/**
331 331
      * Add a command to install an event handler on the specified element
332 332
      * You can add more than one event handler to an element's event using this method.
333 333
      * @deprecated Event handler functions are deprecated
@@ -338,17 +338,17 @@  discard block
 block discarded – undo
338 338
      *
339 339
      * @return self
340 340
      */
341
-    public function addHandler(string $sTarget, string $sEvent, string $sHandler): self
342
-    {
343
-        $this->xManager->addCommand('handler.add', [
344
-            'id' => $this->str($sTarget),
345
-            'event' => $this->str($sEvent),
346
-            'func' => $this->str($sHandler),
347
-        ]);
348
-        return $this;
349
-    }
341
+public function addHandler(string $sTarget, string $sEvent, string $sHandler): self
342
+{
343
+$this->xManager->addCommand('handler.add', [
344
+'id' => $this->str($sTarget),
345
+'event' => $this->str($sEvent),
346
+'func' => $this->str($sHandler),
347
+]);
348
+return $this;
349
+}
350 350
 
351
-    /**
351
+/**
352 352
      * Add a command to remove an event handler from an element
353 353
      * @deprecated Event handler functions are deprecated
354 354
      *
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
      *
359 359
      * @return self
360 360
      */
361
-    public function removeHandler(string $sTarget, string $sEvent, string $sHandler): self
362
-    {
363
-        $this->xManager->addCommand('handler.remove', [
364
-            'id' => $this->str($sTarget),
365
-            'event' => $this->str($sEvent),
366
-            'func' => $this->str($sHandler),
367
-        ]);
368
-        return $this;
369
-    }
361
+public function removeHandler(string $sTarget, string $sEvent, string $sHandler): self
362
+{
363
+$this->xManager->addCommand('handler.remove', [
364
+'id' => $this->str($sTarget),
365
+'event' => $this->str($sEvent),
366
+'func' => $this->str($sHandler),
367
+]);
368
+return $this;
369
+}
370 370
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/AbstractResponsePlugin.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@
 block discarded – undo
27 27
 
28 28
 abstract class AbstractResponsePlugin extends AbstractPlugin implements ResponsePluginInterface
29 29
 {
30
-    use ResponsePluginTrait;
30
+use ResponsePluginTrait;
31 31
 
32
-    /**
32
+/**
33 33
      * Initialize the plugin
34 34
      *
35 35
      * @return void
36 36
      */
37
-    protected function init(): void
38
-    {}
37
+protected function init(): void
38
+{}
39 39
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/PluginInterface.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,10 +4,10 @@
 block discarded – undo
4 4
 
5 5
 interface PluginInterface
6 6
 {
7
-    /**
7
+/**
8 8
      * Get a unique name to identify the plugin.
9 9
      *
10 10
      * @return string
11 11
      */
12
-    public function getName(): string;
12
+public function getName(): string;
13 13
 }
Please login to merge, or discard this patch.
jaxon-core/src/Script/ParameterFactory.php 1 patch
Switch Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,109 +19,109 @@
 block discarded – undo
19 19
 
20 20
 class ParameterFactory
21 21
 {
22
-    /**
22
+/**
23 23
      * Make a parameter of type form values
24 24
      *
25 25
      * @param string $sFormId    The id of the HTML form
26 26
      *
27 27
      * @return array
28 28
      */
29
-    public function form(string $sFormId): array
30
-    {
31
-        return (new HtmlReader($sFormId))->form();
32
-    }
29
+public function form(string $sFormId): array
30
+{
31
+return (new HtmlReader($sFormId))->form();
32
+}
33 33
 
34
-    /**
34
+/**
35 35
      * Make a parameter of type input value
36 36
      *
37 37
      * @param string $sInputId    the id of the HTML input element
38 38
      *
39 39
      * @return TypedValue
40 40
      */
41
-    public function input(string $sInputId): TypedValue
42
-    {
43
-        return (new HtmlReader($sInputId))->input();
44
-    }
41
+public function input(string $sInputId): TypedValue
42
+{
43
+return (new HtmlReader($sInputId))->input();
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * Make a parameter of type checked value
48 48
      *
49 49
      * @param string $sInputId    the name of the HTML form element
50 50
      *
51 51
      * @return array
52 52
      */
53
-    public function checked(string $sInputId): array
54
-    {
55
-        return (new HtmlReader($sInputId))->checked();
56
-    }
53
+public function checked(string $sInputId): array
54
+{
55
+return (new HtmlReader($sInputId))->checked();
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * Make a parameter of type select
60 60
      *
61 61
      * @param string $sInputId    the name of the HTML form element
62 62
      *
63 63
      * @return TypedValue
64 64
      */
65
-    public function select(string $sInputId): TypedValue
66
-    {
67
-        return $this->input($sInputId);
68
-    }
65
+public function select(string $sInputId): TypedValue
66
+{
67
+return $this->input($sInputId);
68
+}
69 69
 
70
-    /**
70
+/**
71 71
      * Make a parameter of type inner html
72 72
      *
73 73
      * @param string $sElementId    the id of the HTML element
74 74
      *
75 75
      * @return TypedValue
76 76
      */
77
-    public function html(string $sElementId): TypedValue
78
-    {
79
-        return (new HtmlReader($sElementId))->html();
80
-    }
77
+public function html(string $sElementId): TypedValue
78
+{
79
+return (new HtmlReader($sElementId))->html();
80
+}
81 81
 
82
-    /**
82
+/**
83 83
      * Make a parameter of type quoted string
84 84
      *
85 85
      * @param string $sValue    the value of the parameter
86 86
      *
87 87
      * @return TypedValue
88 88
      */
89
-    public function string(string $sValue): TypedValue
90
-    {
91
-        return TypedValue::make($sValue);
92
-    }
89
+public function string(string $sValue): TypedValue
90
+{
91
+return TypedValue::make($sValue);
92
+}
93 93
 
94
-    /**
94
+/**
95 95
      * Make a parameter of type numeric
96 96
      *
97 97
      * @param int $nValue    the value of the parameter
98 98
      *
99 99
      * @return TypedValue
100 100
      */
101
-    public function numeric(int $nValue): TypedValue
102
-    {
103
-        return TypedValue::make($nValue);
104
-    }
101
+public function numeric(int $nValue): TypedValue
102
+{
103
+return TypedValue::make($nValue);
104
+}
105 105
 
106
-    /**
106
+/**
107 107
      * Make a parameter of type numeric
108 108
      *
109 109
      * @param int $nValue    the value of the parameter
110 110
      *
111 111
      * @return TypedValue
112 112
      */
113
-    public function int(int $nValue): TypedValue
114
-    {
115
-        return $this->numeric($nValue);
116
-    }
113
+public function int(int $nValue): TypedValue
114
+{
115
+return $this->numeric($nValue);
116
+}
117 117
 
118
-    /**
118
+/**
119 119
      * Make a parameter of type page number
120 120
      *
121 121
      * @return TypedValue
122 122
      */
123
-    public function page(): TypedValue
124
-    {
125
-        return TypedValue::page();
126
-    }
123
+public function page(): TypedValue
124
+{
125
+return TypedValue::page();
126
+}
127 127
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/DiAutoTrait.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
         $xType = $xParameter->getType();
46 46
         $sParameterName = '$' . $xParameter->getName();
47 47
         // Check the parameter class first.
48
-        if($xType instanceof ReflectionNamedType)
48
+        if ($xType instanceof ReflectionNamedType)
49 49
         {
50 50
             $sParameterType = $xType->getName();
51 51
             // The class + the name
52
-            if($this->cn()->has("$sParameterType $sParameterName"))
52
+            if ($this->cn()->has("$sParameterType $sParameterName"))
53 53
             {
54 54
                 return $this->cn()->get("$sParameterType $sParameterName");
55 55
             }
56 56
             // The class only
57
-            if($this->cn()->has($sParameterType))
57
+            if ($this->cn()->has($sParameterType))
58 58
             {
59 59
                 return $this->cn()->get($sParameterType);
60 60
             }
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function make(string|ReflectionClass $xClass): mixed
76 76
     {
77
-        if(is_string($xClass))
77
+        if (is_string($xClass))
78 78
         {
79 79
             // Create the reflection class instance
80 80
             $xClass = new ReflectionClass($xClass);
81 81
         }
82 82
         // Use the Reflection class to get the parameters of the constructor
83
-        if(($constructor = $xClass->getConstructor()) === null)
83
+        if (($constructor = $xClass->getConstructor()) === null)
84 84
         {
85 85
             return $xClass->newInstance();
86 86
         }
Please login to merge, or discard this patch.