Passed
Push — main ( 525366...99eb4f )
by Thierry
03:58
created
jaxon-utils/tests/translations/test.fr.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'salutations' => [
5
-        'morning' => "Bonjour",
6
-        'afternoon' => "Bonsoir",
7
-    ],
8
-    'placeholders' => [
9
-        'morning' => "Bonjour :title :name",
10
-        'afternoon' => "Bonsoir :title :name",
11
-    ],
4
+'salutations' => [
5
+'morning' => "Bonjour",
6
+'afternoon' => "Bonsoir",
7
+],
8
+'placeholders' => [
9
+'morning' => "Bonjour :title :name",
10
+'afternoon' => "Bonsoir :title :name",
11
+],
12 12
 ];
Please login to merge, or discard this patch.
jaxon-utils/tests/TestUriDetector/UriDetectorTest.php 1 patch
Switch Indentation   +180 added lines, -180 removed lines patch added patch discarded remove patch
@@ -8,202 +8,202 @@
 block discarded – undo
8 8
 
9 9
 final class UriDetectorTest extends TestCase
10 10
 {
11
-    /**
11
+/**
12 12
      * @var UriDetector
13 13
      */
14
-    protected $xUriDetector;
14
+protected $xUriDetector;
15 15
 
16
-    protected function setUp(): void
17
-    {
18
-        $this->xUriDetector = new UriDetector();
19
-    }
16
+protected function setUp(): void
17
+{
18
+$this->xUriDetector = new UriDetector();
19
+}
20 20
 
21
-    /**
21
+/**
22 22
      * @throws UriException
23 23
      */
24
-    public function testUri()
25
-    {
26
-        $this->assertEquals('http://example.test/path', $this->xUriDetector->detect([
27
-            'REQUEST_URI' => 'http://example.test/path'
28
-        ]));
29
-    }
30
-
31
-    /**
24
+public function testUri()
25
+{
26
+$this->assertEquals('http://example.test/path', $this->xUriDetector->detect([
27
+'REQUEST_URI' => 'http://example.test/path'
28
+]));
29
+}
30
+
31
+/**
32 32
      * @throws UriException
33 33
      */
34
-    public function testUriWithParam()
35
-    {
36
-        $this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
37
-            $this->xUriDetector->detect([
38
-                'REQUEST_URI' => 'http://example.test/path?param1=value1&param2="value2"',
39
-            ])
40
-        );
41
-    }
42
-
43
-    /**
34
+public function testUriWithParam()
35
+{
36
+$this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
37
+$this->xUriDetector->detect([
38
+    'REQUEST_URI' => 'http://example.test/path?param1=value1&param2="value2"',
39
+])
40
+);
41
+}
42
+
43
+/**
44 44
      * @throws UriException
45 45
      */
46
-    public function testUriWithUser()
47
-    {
48
-        $this->assertEquals('http://[email protected]/path', $this->xUriDetector->detect([
49
-            'REQUEST_URI' => 'http://[email protected]/path'
50
-        ]));
51
-    }
52
-
53
-    /**
46
+public function testUriWithUser()
47
+{
48
+$this->assertEquals('http://[email protected]/path', $this->xUriDetector->detect([
49
+'REQUEST_URI' => 'http://[email protected]/path'
50
+]));
51
+}
52
+
53
+/**
54 54
      * @throws UriException
55 55
      */
56
-    public function testUriWithUserAndPass()
57
-    {
58
-        $this->assertEquals('http://user:[email protected]/path', $this->xUriDetector->detect([
59
-            'REQUEST_URI' => 'http://user:[email protected]/path'
60
-        ]));
61
-    }
62
-
63
-    /**
56
+public function testUriWithUserAndPass()
57
+{
58
+$this->assertEquals('http://user:[email protected]/path', $this->xUriDetector->detect([
59
+'REQUEST_URI' => 'http://user:[email protected]/path'
60
+]));
61
+}
62
+
63
+/**
64 64
      * @throws UriException
65 65
      */
66
-    public function testUriWithEmptyBasename()
67
-    {
68
-        $this->assertEquals('http://example.test/', $this->xUriDetector->detect([
69
-            'REQUEST_URI' => 'http://example.test//'
70
-        ]));
71
-    }
72
-
73
-    /**
66
+public function testUriWithEmptyBasename()
67
+{
68
+$this->assertEquals('http://example.test/', $this->xUriDetector->detect([
69
+'REQUEST_URI' => 'http://example.test//'
70
+]));
71
+}
72
+
73
+/**
74 74
      * @throws UriException
75 75
      */
76
-    public function testUriWithParts()
77
-    {
78
-        $this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
79
-            $this->xUriDetector->detect([
80
-                'HTTP_SCHEME' => 'http',
81
-                'HTTP_HOST' => 'example.test',
82
-                'PATH_INFO' => '/path',
83
-                'QUERY_STRING' => 'param1=value1&param2="value2"',
84
-            ])
85
-        );
86
-        $this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
87
-            $this->xUriDetector->detect([
88
-                'HTTPS' => 'off',
89
-                'HTTP_HOST' => 'example.test',
90
-                'PATH_INFO' => '/path',
91
-                'QUERY_STRING' => 'param1=value1&param2="value2"',
92
-            ])
93
-        );
94
-        $this->assertEquals('https://example.test:8080/path',
95
-            $this->xUriDetector->detect([
96
-                'HTTPS' => 'on',
97
-                'SERVER_NAME' => 'example.test:8080',
98
-                'PATH_INFO' => '/path',
99
-            ])
100
-        );
101
-        $this->assertEquals('https://example.test:8080/path',
102
-            $this->xUriDetector->detect([
103
-                'HTTPS' => 'on',
104
-                'SERVER_NAME' => 'example.test',
105
-                'SERVER_PORT' => '8080',
106
-                'PATH_INFO' => '/path',
107
-            ])
108
-        );
109
-        $this->assertEquals('https://example.test:8080/path',
110
-            $this->xUriDetector->detect([
111
-                'HTTP_X_FORWARDED_SSL' => 'on',
112
-                'SERVER_NAME' => 'example.test:8080',
113
-                'PATH_INFO' => '/path',
114
-            ])
115
-        );
116
-        $this->assertEquals('https://example.test:8080/path',
117
-            $this->xUriDetector->detect([
118
-                'HTTP_X_FORWARDED_PROTO' => 'https',
119
-                'SERVER_NAME' => 'example.test:8080',
120
-                'PATH_INFO' => '/path',
121
-            ])
122
-        );
123
-    }
124
-
125
-    /**
76
+public function testUriWithParts()
77
+{
78
+$this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
79
+$this->xUriDetector->detect([
80
+    'HTTP_SCHEME' => 'http',
81
+    'HTTP_HOST' => 'example.test',
82
+    'PATH_INFO' => '/path',
83
+    'QUERY_STRING' => 'param1=value1&param2="value2"',
84
+])
85
+);
86
+$this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
87
+$this->xUriDetector->detect([
88
+    'HTTPS' => 'off',
89
+    'HTTP_HOST' => 'example.test',
90
+    'PATH_INFO' => '/path',
91
+    'QUERY_STRING' => 'param1=value1&param2="value2"',
92
+])
93
+);
94
+$this->assertEquals('https://example.test:8080/path',
95
+$this->xUriDetector->detect([
96
+    'HTTPS' => 'on',
97
+    'SERVER_NAME' => 'example.test:8080',
98
+    'PATH_INFO' => '/path',
99
+])
100
+);
101
+$this->assertEquals('https://example.test:8080/path',
102
+$this->xUriDetector->detect([
103
+    'HTTPS' => 'on',
104
+    'SERVER_NAME' => 'example.test',
105
+    'SERVER_PORT' => '8080',
106
+    'PATH_INFO' => '/path',
107
+])
108
+);
109
+$this->assertEquals('https://example.test:8080/path',
110
+$this->xUriDetector->detect([
111
+    'HTTP_X_FORWARDED_SSL' => 'on',
112
+    'SERVER_NAME' => 'example.test:8080',
113
+    'PATH_INFO' => '/path',
114
+])
115
+);
116
+$this->assertEquals('https://example.test:8080/path',
117
+$this->xUriDetector->detect([
118
+    'HTTP_X_FORWARDED_PROTO' => 'https',
119
+    'SERVER_NAME' => 'example.test:8080',
120
+    'PATH_INFO' => '/path',
121
+])
122
+);
123
+}
124
+
125
+/**
126 126
      * @throws UriException
127 127
      */
128
-    public function testRemoveJaxonParam()
129
-    {
130
-        $this->assertEquals('http://example.test/path', $this->xUriDetector->detect([
131
-            'REQUEST_URI' => 'http://example.test/path?jxnGenerate=true'
132
-        ]));
133
-        $this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
134
-            $this->xUriDetector->detect([
135
-                'REQUEST_URI' => 'http://example.test/path?param1=value1&jxnGenerate=true&param2="value2"',
136
-            ])
137
-        );
138
-    }
139
-
140
-    public function testErrorMissingHost()
141
-    {
142
-        $this->expectException(UriException::class);
143
-        $this->xUriDetector->detect([
144
-            'HTTPS' => 'on',
145
-            'PATH_INFO' => '/path',
146
-            'QUERY_STRING' => 'param1=value1&param2="value2"',
147
-        ]);
148
-    }
149
-
150
-    public function testRedirectSimpleUrl()
151
-    {
152
-        $this->assertEquals('http://example.test/path',
153
-            $this->xUriDetector->redirect('http://example.test/path', []));
154
-    }
155
-
156
-    public function testRedirectUrlWithAnchor()
157
-    {
158
-        $this->assertEquals('http://example.test/path?param=value#anchor',
159
-            $this->xUriDetector->redirect('http://example.test/path?param=value#anchor', []));
160
-    }
161
-
162
-    public function testRedirectUrlWithParam()
163
-    {
164
-        $this->assertEquals('http://example.test/path?param=value',
165
-            $this->xUriDetector->redirect('http://example.test/path?param=value', []));
166
-    }
167
-
168
-    public function testRedirectUrlWithParams()
169
-    {
170
-        $this->assertEquals('http://example.test/path?param1=value1&param2=value2',
171
-            $this->xUriDetector->redirect('http://example.test/path?param1=value1&param2=value2', []));
172
-    }
173
-
174
-    public function testRedirectUrlWithSpecialChars()
175
-    {
176
-        $this->assertEquals('http://example.test/path?param1=%22value1%22&param2=%25value2%25#anchor',
177
-            $this->xUriDetector->redirect('http://example.test/path?param1="value1"&param2=%value2%#anchor', []));
178
-    }
179
-
180
-    public function testRedirectSpecialUrl()
181
-    {
182
-        $this->assertEquals('http://example.test/?query1234',
183
-            $this->xUriDetector->redirect('http://example.test/?query1234', []));
184
-
185
-        $this->assertEquals('http://example.test/?query1234=',
186
-            $this->xUriDetector->redirect('http://example.test/?query1234=', []));
187
-
188
-        $this->assertEquals('http://example.test/?param=value&query1234=0',
189
-            $this->xUriDetector->redirect('http://example.test/?param=value&query1234=0', []));
190
-    }
191
-
192
-    public function testRedirectEncodedUrl()
193
-    {
194
-        $this->assertEquals('http://example.test/path?param1=%22value1%22&param2=%25value2%25',
195
-            $this->xUriDetector->redirect('http://example.test/path?param1=%22value1%22&param2=%25value2%25', []));
196
-    }
197
-
198
-    public function testRedirectUnexpectedUrl()
199
-    {
200
-        $this->assertEquals('http://example.test/',
201
-            $this->xUriDetector->redirect('http://example.test/? ', []));
202
-    }
203
-
204
-    public function testRedirectQueryString()
205
-    {
206
-        $this->assertEquals('http://example.test/?param1=value1',
207
-            $this->xUriDetector->redirect('http://example.test/? ', ['QUERY_STRING' => 'param1=value1']));
208
-    }
128
+public function testRemoveJaxonParam()
129
+{
130
+$this->assertEquals('http://example.test/path', $this->xUriDetector->detect([
131
+'REQUEST_URI' => 'http://example.test/path?jxnGenerate=true'
132
+]));
133
+$this->assertEquals('http://example.test/path?param1=value1&param2=%22value2%22',
134
+$this->xUriDetector->detect([
135
+    'REQUEST_URI' => 'http://example.test/path?param1=value1&jxnGenerate=true&param2="value2"',
136
+])
137
+);
138
+}
139
+
140
+public function testErrorMissingHost()
141
+{
142
+$this->expectException(UriException::class);
143
+$this->xUriDetector->detect([
144
+'HTTPS' => 'on',
145
+'PATH_INFO' => '/path',
146
+'QUERY_STRING' => 'param1=value1&param2="value2"',
147
+]);
148
+}
149
+
150
+public function testRedirectSimpleUrl()
151
+{
152
+$this->assertEquals('http://example.test/path',
153
+$this->xUriDetector->redirect('http://example.test/path', []));
154
+}
155
+
156
+public function testRedirectUrlWithAnchor()
157
+{
158
+$this->assertEquals('http://example.test/path?param=value#anchor',
159
+$this->xUriDetector->redirect('http://example.test/path?param=value#anchor', []));
160
+}
161
+
162
+public function testRedirectUrlWithParam()
163
+{
164
+$this->assertEquals('http://example.test/path?param=value',
165
+$this->xUriDetector->redirect('http://example.test/path?param=value', []));
166
+}
167
+
168
+public function testRedirectUrlWithParams()
169
+{
170
+$this->assertEquals('http://example.test/path?param1=value1&param2=value2',
171
+$this->xUriDetector->redirect('http://example.test/path?param1=value1&param2=value2', []));
172
+}
173
+
174
+public function testRedirectUrlWithSpecialChars()
175
+{
176
+$this->assertEquals('http://example.test/path?param1=%22value1%22&param2=%25value2%25#anchor',
177
+$this->xUriDetector->redirect('http://example.test/path?param1="value1"&param2=%value2%#anchor', []));
178
+}
179
+
180
+public function testRedirectSpecialUrl()
181
+{
182
+$this->assertEquals('http://example.test/?query1234',
183
+$this->xUriDetector->redirect('http://example.test/?query1234', []));
184
+
185
+$this->assertEquals('http://example.test/?query1234=',
186
+$this->xUriDetector->redirect('http://example.test/?query1234=', []));
187
+
188
+$this->assertEquals('http://example.test/?param=value&query1234=0',
189
+$this->xUriDetector->redirect('http://example.test/?param=value&query1234=0', []));
190
+}
191
+
192
+public function testRedirectEncodedUrl()
193
+{
194
+$this->assertEquals('http://example.test/path?param1=%22value1%22&param2=%25value2%25',
195
+$this->xUriDetector->redirect('http://example.test/path?param1=%22value1%22&param2=%25value2%25', []));
196
+}
197
+
198
+public function testRedirectUnexpectedUrl()
199
+{
200
+$this->assertEquals('http://example.test/',
201
+$this->xUriDetector->redirect('http://example.test/? ', []));
202
+}
203
+
204
+public function testRedirectQueryString()
205
+{
206
+$this->assertEquals('http://example.test/?param1=value1',
207
+$this->xUriDetector->redirect('http://example.test/? ', ['QUERY_STRING' => 'param1=value1']));
208
+}
209 209
 }
Please login to merge, or discard this patch.
jaxon-utils/src/Template/TemplateEngine.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 
20 20
 class TemplateEngine
21 21
 {
22
-    /**
22
+/**
23 23
      * The default namespace
24 24
      *
25 25
      * @var string
26 26
      */
27
-    protected $sDefaultNamespace = '';
27
+protected $sDefaultNamespace = '';
28 28
 
29
-    /**
29
+/**
30 30
      * The namespaces
31 31
      *
32 32
      * @var array
33 33
      */
34
-    protected $aNamespaces;
34
+protected $aNamespaces;
35 35
 
36
-    /**
36
+/**
37 37
      * Set the default namespace
38 38
      *
39 39
      * @param string $sDefaultNamespace
40 40
      *
41 41
      * @return void
42 42
      */
43
-    public function setDefaultNamespace(string $sDefaultNamespace): void
44
-    {
45
-        $this->sDefaultNamespace = $sDefaultNamespace;
46
-    }
43
+public function setDefaultNamespace(string $sDefaultNamespace): void
44
+{
45
+$this->sDefaultNamespace = $sDefaultNamespace;
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * Add a namespace to the template system
50 50
      *
51 51
      * @param string $sNamespace The namespace name
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @return static
56 56
      */
57
-    public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): static
58
-    {
59
-        $this->aNamespaces[$sNamespace] = [
60
-            'directory' => rtrim(trim($sDirectory), "/\\") . DIRECTORY_SEPARATOR,
61
-            'extension' => $sExtension,
62
-        ];
63
-        return $this;
64
-    }
57
+public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): static
58
+{
59
+$this->aNamespaces[$sNamespace] = [
60
+'directory' => rtrim(trim($sDirectory), "/\\") . DIRECTORY_SEPARATOR,
61
+'extension' => $sExtension,
62
+];
63
+return $this;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * Render a template
68 68
      *
69 69
      * @param string $sTemplate The name of template to be rendered
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      *
72 72
      * @return string
73 73
      */
74
-    public function render(string $sTemplate, array $aVars = []): string
75
-    {
76
-        $context = new Context($this->aNamespaces, $this->sDefaultNamespace, $sTemplate);
77
-        return $context->__render($aVars);
78
-    }
74
+public function render(string $sTemplate, array $aVars = []): string
75
+{
76
+$context = new Context($this->aNamespaces, $this->sDefaultNamespace, $sTemplate);
77
+return $context->__render($aVars);
78
+}
79 79
 }
Please login to merge, or discard this patch.
jaxon-flot/src/register.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 function register(): void
31 31
 {
32 32
     // Do nothing if running in cli.
33
-    if(php_sapi_name() !== 'cli')
33
+    if (php_sapi_name() !== 'cli')
34 34
     {
35 35
         _register();
36 36
     };
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Metadata.php 2 patches
Switch Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -21,161 +21,161 @@
 block discarded – undo
21 21
 
22 22
 class Metadata
23 23
 {
24
-    /**
24
+/**
25 25
      * @var array<string, array<string, Data\AbstractData>>
26 26
      */
27
-    private array $aAttributes = [
28
-        'exclude' => [],
29
-        'container' => [],
30
-        'databag' => [],
31
-        'callback' => [],
32
-        'before' => [],
33
-        'after' => [],
34
-        'upload' => [],
35
-    ];
36
-
37
-    /**
27
+private array $aAttributes = [
28
+'exclude' => [],
29
+'container' => [],
30
+'databag' => [],
31
+'callback' => [],
32
+'before' => [],
33
+'after' => [],
34
+'upload' => [],
35
+];
36
+
37
+/**
38 38
      * @return array<string, array<string, Data\AbstractData>>
39 39
      */
40
-    public function getAttributes(): array
41
-    {
42
-        return $this->aAttributes;
43
-    }
40
+public function getAttributes(): array
41
+{
42
+return $this->aAttributes;
43
+}
44 44
 
45
-    /**
45
+/**
46 46
      * @param string $sMethod
47 47
      *
48 48
      * @return Data\ExcludeData
49 49
      */
50
-    public function exclude(string $sMethod = '*'): Data\ExcludeData
51
-    {
52
-        return $this->aAttributes['exclude'][$sMethod] ??
53
-            $this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
54
-    }
50
+public function exclude(string $sMethod = '*'): Data\ExcludeData
51
+{
52
+return $this->aAttributes['exclude'][$sMethod] ??
53
+$this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
54
+}
55 55
 
56
-    /**
56
+/**
57 57
      * @param string $sMethod
58 58
      *
59 59
      * @return Data\ContainerData
60 60
      */
61
-    public function container(string $sMethod = '*'): Data\ContainerData
62
-    {
63
-        return $this->aAttributes['container'][$sMethod] ??
64
-            $this->aAttributes['container'][$sMethod] = new Data\ContainerData();
65
-    }
61
+public function container(string $sMethod = '*'): Data\ContainerData
62
+{
63
+return $this->aAttributes['container'][$sMethod] ??
64
+$this->aAttributes['container'][$sMethod] = new Data\ContainerData();
65
+}
66 66
 
67
-    /**
67
+/**
68 68
      * @param string $sMethod
69 69
      *
70 70
      * @return Data\DatabagData
71 71
      */
72
-    public function databag(string $sMethod = '*'): Data\DatabagData
73
-    {
74
-        return $this->aAttributes['databag'][$sMethod] ??
75
-            $this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
76
-    }
72
+public function databag(string $sMethod = '*'): Data\DatabagData
73
+{
74
+return $this->aAttributes['databag'][$sMethod] ??
75
+$this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
76
+}
77 77
 
78
-    /**
78
+/**
79 79
      * @param string $sMethod
80 80
      *
81 81
      * @return Data\CallbackData
82 82
      */
83
-    public function callback(string $sMethod = '*'): Data\CallbackData
84
-    {
85
-        return $this->aAttributes['callback'][$sMethod] ??
86
-            $this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
87
-    }
83
+public function callback(string $sMethod = '*'): Data\CallbackData
84
+{
85
+return $this->aAttributes['callback'][$sMethod] ??
86
+$this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
87
+}
88 88
 
89
-    /**
89
+/**
90 90
      * @param string $sMethod
91 91
      *
92 92
      * @return Data\BeforeData
93 93
      */
94
-    public function before(string $sMethod = '*'): Data\BeforeData
95
-    {
96
-        return $this->aAttributes['before'][$sMethod] ??
97
-            $this->aAttributes['before'][$sMethod] = new Data\BeforeData();
98
-    }
94
+public function before(string $sMethod = '*'): Data\BeforeData
95
+{
96
+return $this->aAttributes['before'][$sMethod] ??
97
+$this->aAttributes['before'][$sMethod] = new Data\BeforeData();
98
+}
99 99
 
100
-    /**
100
+/**
101 101
      * @param string $sMethod
102 102
      *
103 103
      * @return Data\AfterData
104 104
      */
105
-    public function after(string $sMethod = '*'): Data\AfterData
106
-    {
107
-        return $this->aAttributes['after'][$sMethod] ??
108
-            $this->aAttributes['after'][$sMethod] = new Data\AfterData();
109
-    }
105
+public function after(string $sMethod = '*'): Data\AfterData
106
+{
107
+return $this->aAttributes['after'][$sMethod] ??
108
+$this->aAttributes['after'][$sMethod] = new Data\AfterData();
109
+}
110 110
 
111
-    /**
111
+/**
112 112
      * @param string $sMethod
113 113
      *
114 114
      * @return Data\UploadData
115 115
      */
116
-    public function upload(string $sMethod = '*'): Data\UploadData
117
-    {
118
-        return $this->aAttributes['upload'][$sMethod] ??
119
-            $this->aAttributes['upload'][$sMethod] = new Data\UploadData();
120
-    }
116
+public function upload(string $sMethod = '*'): Data\UploadData
117
+{
118
+return $this->aAttributes['upload'][$sMethod] ??
119
+$this->aAttributes['upload'][$sMethod] = new Data\UploadData();
120
+}
121 121
 
122
-    /**
122
+/**
123 123
      * True if the class is excluded
124 124
      *
125 125
      * @return bool
126 126
      */
127
-    public function isExcluded(): bool
128
-    {
129
-        $xData = $this->aAttributes['exclude']['*'] ?? null;
130
-        return $xData !== null && $xData->getValue() === true;
131
-    }
127
+public function isExcluded(): bool
128
+{
129
+$xData = $this->aAttributes['exclude']['*'] ?? null;
130
+return $xData !== null && $xData->getValue() === true;
131
+}
132 132
 
133
-    /**
133
+/**
134 134
      * Get the properties of the class methods
135 135
      *
136 136
      * @return array
137 137
      */
138
-    public function getProperties(): array
138
+public function getProperties(): array
139
+{
140
+$aProperties = [];
141
+$aClassProperties = [];
142
+foreach($this->aAttributes as $sType => $aValues)
143
+{
144
+if($sType === 'exclude')
145
+{
146
+    continue;
147
+}
148
+
149
+foreach($aValues as $sMethod => $xData)
150
+{
151
+    if($sMethod === '*')
139 152
     {
140
-        $aProperties = [];
141
-        $aClassProperties = [];
142
-        foreach($this->aAttributes as $sType => $aValues)
143
-        {
144
-            if($sType === 'exclude')
145
-            {
146
-                continue;
147
-            }
148
-
149
-            foreach($aValues as $sMethod => $xData)
150
-            {
151
-                if($sMethod === '*')
152
-                {
153
-                    $aClassProperties[$xData->getName()] = $xData->getValue();
154
-                    continue;
155
-                }
156
-                $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
157
-            }
158
-        }
159
-
160
-        if(count($aClassProperties) > 0)
161
-        {
162
-            $aProperties['*'] = $aClassProperties;
163
-        }
164
-
165
-        return $aProperties;
153
+        $aClassProperties[$xData->getName()] = $xData->getValue();
154
+        continue;
166 155
     }
156
+    $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
157
+}
158
+}
159
+
160
+if(count($aClassProperties) > 0)
161
+{
162
+$aProperties['*'] = $aClassProperties;
163
+}
164
+
165
+return $aProperties;
166
+}
167 167
 
168
-    /**
168
+/**
169 169
      * Get the protected methods
170 170
      *
171 171
      * @return array
172 172
      */
173
-    public function getProtectedMethods(): array
174
-    {
175
-        /** @var array<Data\ExcludeData> */
176
-        $aAttributes = $this->aAttributes['exclude'];
177
-        $aMethods = array_keys($aAttributes);
178
-        return array_values(array_filter($aMethods, fn(string $sName) =>
179
-            $sName !== '*' && $aAttributes[$sName]->getValue() === true));
180
-    }
173
+public function getProtectedMethods(): array
174
+{
175
+/** @var array<Data\ExcludeData> */
176
+$aAttributes = $this->aAttributes['exclude'];
177
+$aMethods = array_keys($aAttributes);
178
+return array_values(array_filter($aMethods, fn(string $sName) =>
179
+$sName !== '*' && $aAttributes[$sName]->getValue() === true));
180
+}
181 181
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -139,16 +139,16 @@  discard block
 block discarded – undo
139 139
     {
140 140
         $aProperties = [];
141 141
         $aClassProperties = [];
142
-        foreach($this->aAttributes as $sType => $aValues)
142
+        foreach ($this->aAttributes as $sType => $aValues)
143 143
         {
144
-            if($sType === 'exclude')
144
+            if ($sType === 'exclude')
145 145
             {
146 146
                 continue;
147 147
             }
148 148
 
149
-            foreach($aValues as $sMethod => $xData)
149
+            foreach ($aValues as $sMethod => $xData)
150 150
             {
151
-                if($sMethod === '*')
151
+                if ($sMethod === '*')
152 152
                 {
153 153
                     $aClassProperties[$xData->getName()] = $xData->getValue();
154 154
                     continue;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
             }
158 158
         }
159 159
 
160
-        if(count($aClassProperties) > 0)
160
+        if (count($aClassProperties) > 0)
161 161
         {
162 162
             $aProperties['*'] = $aClassProperties;
163 163
         }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableObject.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,8 +75,7 @@  discard block
 block discarded – undo
75 75
      */
76 76
     public function excluded(?string $sMethodName = null): bool
77 77
     {
78
-        return $sMethodName === null ? $this->xOptions->excluded() :
79
-            $this->xOptions->isProtectedMethod($sMethodName);
78
+        return $sMethodName === null ? $this->xOptions->excluded() : $this->xOptions->isProtectedMethod($sMethodName);
80 79
     }
81 80
 
82 81
     /**
@@ -176,11 +175,11 @@  discard block
 block discarded – undo
176 175
         $sMethod = $this->xTarget->getMethodName();
177 176
         // The hooks defined at method level are merged with those defined at class level.
178 177
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
179
-        foreach($aMethods as $xKey => $xValue)
178
+        foreach ($aMethods as $xKey => $xValue)
180 179
         {
181 180
             $sHookName = $xValue;
182 181
             $aHookArgs = [];
183
-            if(is_string($xKey))
182
+            if (is_string($xKey))
184 183
             {
185 184
                 $sHookName = $xKey;
186 185
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
             // Warning: dynamic properties will be deprecated in PHP8.2.
219 218
             $this->$sAttr = $xDiValue;
220 219
         };
221
-        foreach($aDiOptions as $sAttr => $sClass)
220
+        foreach ($aDiOptions as $sAttr => $sClass)
222 221
         {
223 222
             $this->setDiAttribute($xComponent, $sAttr, $this->di->get($sClass), $cSetter);
224 223
         }
Please login to merge, or discard this patch.
jaxon-core/src/Script/CallFactory.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,7 @@
 block discarded – undo
50 50
     public function rq(string $sClassName = ''): ?JxnCall
51 51
     {
52 52
         $sClassName = trim($sClassName);
53
-        return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() :
54
-            $this->cdi->getComponentRequestFactory($sClassName);
53
+        return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : $this->cdi->getComponentRequestFactory($sClassName);
55 54
     }
56 55
 
57 56
     /**
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/ComponentTrait.php 2 patches
Spacing   +12 added lines, -13 removed lines patch added patch discarded remove patch
@@ -136,12 +136,12 @@  discard block
 block discarded – undo
136 136
      */
137 137
     private function discoverComponent(string $sClassName)
138 138
     {
139
-        if(!isset($this->aComponents[$sClassName]))
139
+        if (!isset($this->aComponents[$sClassName]))
140 140
         {
141 141
             $xRegistry = $this->cn()->g(ComponentRegistry::class);
142 142
             $xRegistry->updateHash(false); // Disable hash calculation.
143 143
             $aOptions = $xRegistry->getNamespaceComponentOptions($sClassName);
144
-            if($aOptions !== null)
144
+            if ($aOptions !== null)
145 145
             {
146 146
                 $this->registerComponent($sClassName, $aOptions);
147 147
             }
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                 $xRegistry->registerComponentsInDirectories();
153 153
             }
154 154
         }
155
-        if(!isset($this->aComponents[$sClassName]))
155
+        if (!isset($this->aComponents[$sClassName]))
156 156
         {
157 157
             throw new SetupException($this->cn()->g(Translator::class)
158 158
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     public function getCallableObjects(): array
169 169
     {
170 170
         $aCallableObjects = [];
171
-        foreach($this->aComponents as $sClassName => $_)
171
+        foreach ($this->aComponents as $sClassName => $_)
172 172
         {
173 173
             $aCallableObjects[$sClassName] = $this->makeCallableObject($sClassName);
174 174
         }
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
     {
220 220
         /** @var Config|null */
221 221
         $xPackageConfig = $aOptions['config'] ?? null;
222
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
222
+        if ($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
223 223
         {
224 224
             return null;
225 225
         }
226 226
         $sReaderId = $xPackageConfig->getOption('metadata.reader');
227
-        if(!in_array($sReaderId, ['attributes', 'annotations']))
227
+        if (!in_array($sReaderId, ['attributes', 'annotations']))
228 228
         {
229 229
             return null;
230 230
         }
@@ -234,23 +234,23 @@  discard block
 block discarded – undo
234 234
         $xMetadata = null;
235 235
         $xMetadataCache = null;
236 236
         $xConfig = $di->config();
237
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
237
+        if ($xConfig->getAppOption('metadata.cache.enabled', false))
238 238
         {
239
-            if(!$di->h('jaxon_metadata_cache_dir'))
239
+            if (!$di->h('jaxon_metadata_cache_dir'))
240 240
             {
241 241
                 $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
242 242
                 $di->val('jaxon_metadata_cache_dir', $sCacheDir);
243 243
             }
244 244
             $xMetadataCache = $di->getMetadataCache();
245 245
             $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
246
-            if($xMetadata !== null)
246
+            if ($xMetadata !== null)
247 247
             {
248 248
                 return $xMetadata;
249 249
             }
250 250
         }
251 251
 
252 252
         $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
253
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
253
+            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC|
254 254
                 ReflectionProperty::IS_PROTECTED));
255 255
         $aMethods = $this->getPublicMethods($xReflectionClass);
256 256
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
         $xMetadata = $xMetadataReader->getAttributes($xInput);
260 260
 
261 261
         // Try to save the metadata in the cache
262
-        if($xMetadataCache !== null && $xMetadata !== null)
262
+        if ($xMetadataCache !== null && $xMetadata !== null)
263 263
         {
264 264
             $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
265 265
         }
@@ -277,8 +277,7 @@  discard block
 block discarded – undo
277 277
         array $aOptions): ComponentOptions
278 278
     {
279 279
         $xMetadata = $this->getComponentMetadata($xReflectionClass, $aOptions);
280
-        return !$xMetadata ? new ComponentOptions($aOptions) :
281
-            new ComponentOptions($aOptions, $xMetadata->isExcluded(),
280
+        return !$xMetadata ? new ComponentOptions($aOptions) : new ComponentOptions($aOptions, $xMetadata->isExcluded(),
282 281
             $xMetadata->getProtectedMethods(), $xMetadata->getProperties());
283 282
     }
284 283
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@
 block discarded – undo
144 144
             if($aOptions !== null)
145 145
             {
146 146
                 $this->registerComponent($sClassName, $aOptions);
147
-            }
148
-            else // if(!isset($this->aComponents[$sClassName]))
147
+            } else // if(!isset($this->aComponents[$sClassName]))
149 148
             {
150 149
                 // The component was not found in a registered namespace. We need to parse all
151 150
                 // the directories to be able to find a component registered without a namespace.
Please login to merge, or discard this patch.
jaxon-core/src/Di/ComponentContainer.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
      */
139 139
     public function val(string $sKey, $xValue)
140 140
     {
141
-       $this->xContainer->offsetSet($sKey, $xValue);
141
+        $this->xContainer->offsetSet($sKey, $xValue);
142 142
     }
143 143
 
144 144
     /**
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
         try
187 187
         {
188 188
             // Make sure the registered class exists
189
-            if(isset($aOptions['include']))
189
+            if (isset($aOptions['include']))
190 190
             {
191 191
                 require_once $aOptions['include'];
192 192
             }
193 193
             $xReflectionClass = new ReflectionClass($sClassName);
194 194
             // Check if the class is registrable
195
-            if(!$xReflectionClass->isInstantiable())
195
+            if (!$xReflectionClass->isInstantiable())
196 196
             {
197 197
                 return;
198 198
             }
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
             $this->_saveClassOptions($sClassName, $aOptions);
201 201
             $this->val($this->getReflectionClassKey($sClassName), $xReflectionClass);
202 202
             // Register the user class, but only if the user didn't already.
203
-            if(!$this->has($sClassName))
203
+            if (!$this->has($sClassName))
204 204
             {
205 205
                 $this->set($sClassName, function() use($sClassName) {
206 206
                     return $this->make($this->get($this->getReflectionClassKey($sClassName)));
207 207
                 });
208 208
             }
209 209
         }
210
-        catch(ReflectionException $e)
210
+        catch (ReflectionException $e)
211 211
         {
212 212
             throw new SetupException($this->cn()->g(Translator::class)
213 213
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     {
227 227
         $sComponentObject = $this->getCallableObjectKey($sClassName);
228 228
         // Prevent duplication. It's important not to use the class name here.
229
-        if($this->has($sComponentObject))
229
+        if ($this->has($sComponentObject))
230 230
         {
231 231
             return;
232 232
         }
@@ -252,14 +252,14 @@  discard block
 block discarded – undo
252 252
 
253 253
         // Initialize the user class instance
254 254
         $this->xContainer->extend($sClassName, function($xClassInstance) use($sClassName) {
255
-            if($xClassInstance instanceof AbstractComponent)
255
+            if ($xClassInstance instanceof AbstractComponent)
256 256
             {
257 257
                 $xHelper = $this->get($this->getCallableHelperKey($sClassName));
258 258
                 $xHelper->xTarget = $this->xTarget;
259 259
 
260 260
                 // Call the protected "initComponent()" method of the Component class.
261 261
                 $cSetter = function($di, $xHelper) {
262
-                    $this->initComponent($di, $xHelper);  // "$this" here refers to the Component class.
262
+                    $this->initComponent($di, $xHelper); // "$this" here refers to the Component class.
263 263
                 };
264 264
                 $cSetter = $cSetter->bindTo($xClassInstance, $xClassInstance);
265 265
                 call_user_func($cSetter, $this->di, $xHelper);
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
             /** @var CallableObject */
275 275
             $xCallableObject = $this->get($this->getCallableObjectKey($sClassName));
276 276
             $xCallableObject->setDiClassAttributes($xClassInstance);
277
-            if($this->xTarget !== null)
277
+            if ($this->xTarget !== null)
278 278
             {
279 279
                 $sMethodName = $this->xTarget->getMethodName();
280 280
                 $xCallableObject->setDiMethodAttributes($xClassInstance, $sMethodName);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
     private function registerRequestFactory(string $sClassName, string $sFactoryKey)
351 351
     {
352 352
         $this->xContainer->offsetSet($sFactoryKey, function() use($sClassName) {
353
-            if(!($xCallable = $this->makeCallableObject($sClassName)))
353
+            if (!($xCallable = $this->makeCallableObject($sClassName)))
354 354
             {
355 355
                 return null;
356 356
             }
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
     public function getComponentRequestFactory(string $sClassName): ?JxnCall
381 381
     {
382 382
         $sClassName = trim($sClassName, " \t");
383
-        if($sClassName === '')
383
+        if ($sClassName === '')
384 384
         {
385 385
             return null;
386 386
         }
387 387
 
388 388
         $sFactoryKey = $this->getRequestFactoryKey($sClassName);
389
-        if(!$this->has($sFactoryKey))
389
+        if (!$this->has($sFactoryKey))
390 390
         {
391 391
             $this->registerRequestFactory($sClassName, $sFactoryKey);
392 392
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -206,8 +206,7 @@
 block discarded – undo
206 206
                     return $this->make($this->get($this->getReflectionClassKey($sClassName)));
207 207
                 });
208 208
             }
209
-        }
210
-        catch(ReflectionException $e)
209
+        } catch(ReflectionException $e)
211 210
         {
212 211
             throw new SetupException($this->cn()->g(Translator::class)
213 212
                 ->trans('errors.class.invalid', ['name' => $sClassName]));
Please login to merge, or discard this patch.