Passed
Push — main ( 8fa9e1...957ef0 )
by Thierry
06:37
created
jaxon-annotations/tests/TestAnnotation/AnnotationTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.
Switch Indentation   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -16,386 +16,386 @@
 block discarded – undo
16 16
 
17 17
 class AnnotationTest extends TestCase
18 18
 {
19
-    use AnnotationTrait;
19
+use AnnotationTrait;
20 20
 
21
-    /**
21
+/**
22 22
      * @var string
23 23
      */
24
-    protected $sCacheDir;
24
+protected $sCacheDir;
25 25
 
26
-    /**
26
+/**
27 27
      * @throws SetupException
28 28
      */
29
-    public function setUp(): void
30
-    {
31
-        $this->sCacheDir = __DIR__ . '/../tmp';
32
-        @mkdir($this->sCacheDir);
29
+public function setUp(): void
30
+{
31
+$this->sCacheDir = __DIR__ . '/../tmp';
32
+@mkdir($this->sCacheDir);
33 33
 
34
-        jaxon()->di()->getPluginManager()->registerPlugins();
35
-        _register();
34
+jaxon()->di()->getPluginManager()->registerPlugins();
35
+_register();
36 36
 
37
-        jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
38
-    }
37
+jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @throws SetupException
42 42
      */
43
-    public function tearDown(): void
44
-    {
45
-        jaxon()->reset();
46
-        parent::tearDown();
47
-
48
-        // Delete the temp dir and all its content
49
-        $aFiles = scandir($this->sCacheDir);
50
-        foreach ($aFiles as $sFile)
51
-        {
52
-            if($sFile !== '.' && $sFile !== '..')
53
-            {
54
-                @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
55
-            }
56
-        }
57
-        @rmdir($this->sCacheDir);
58
-    }
59
-
60
-    /**
43
+public function tearDown(): void
44
+{
45
+jaxon()->reset();
46
+parent::tearDown();
47
+
48
+// Delete the temp dir and all its content
49
+$aFiles = scandir($this->sCacheDir);
50
+foreach ($aFiles as $sFile)
51
+{
52
+if($sFile !== '.' && $sFile !== '..')
53
+{
54
+    @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
55
+}
56
+}
57
+@rmdir($this->sCacheDir);
58
+}
59
+
60
+/**
61 61
      * @throws SetupException
62 62
      */
63
-    public function testUploadAndExcludeAnnotation()
64
-    {
65
-        $xMetadata = $this->getAttributes(Annotated::class, ['saveFiles', 'doNot']);
66
-        $bExcluded = $xMetadata->isExcluded();
67
-        $aProperties = $xMetadata->getProperties();
68
-        $aExcluded = $xMetadata->getExceptMethods();
63
+public function testUploadAndExcludeAnnotation()
64
+{
65
+$xMetadata = $this->getAttributes(Annotated::class, ['saveFiles', 'doNot']);
66
+$bExcluded = $xMetadata->isExcluded();
67
+$aProperties = $xMetadata->getProperties();
68
+$aExcluded = $xMetadata->getExceptMethods();
69 69
 
70
-        $this->assertFalse($bExcluded);
70
+$this->assertFalse($bExcluded);
71 71
 
72
-        $this->assertCount(1, $aProperties);
73
-        $this->assertArrayHasKey('saveFiles', $aProperties);
74
-        $this->assertCount(1, $aProperties['saveFiles']);
75
-        $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
72
+$this->assertCount(1, $aProperties);
73
+$this->assertArrayHasKey('saveFiles', $aProperties);
74
+$this->assertCount(1, $aProperties['saveFiles']);
75
+$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
76 76
 
77
-        $this->assertCount(1, $aExcluded);
78
-        $this->assertEquals('doNot', $aExcluded[0]);
79
-    }
77
+$this->assertCount(1, $aExcluded);
78
+$this->assertEquals('doNot', $aExcluded[0]);
79
+}
80 80
 
81
-    /**
81
+/**
82 82
      * @throws SetupException
83 83
      */
84
-    public function testDatabagAnnotation()
85
-    {
86
-        $xMetadata = $this->getAttributes(Annotated::class, ['withBags']);
87
-        $bExcluded = $xMetadata->isExcluded();
88
-        $aProperties = $xMetadata->getProperties();
89
-
90
-        $this->assertFalse($bExcluded);
91
-
92
-        $this->assertCount(1, $aProperties);
93
-        $this->assertArrayHasKey('withBags', $aProperties);
94
-        $this->assertCount(1, $aProperties['withBags']);
95
-        $this->assertCount(2, $aProperties['withBags']['bags']);
96
-        $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
97
-        $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
98
-    }
99
-
100
-    /**
84
+public function testDatabagAnnotation()
85
+{
86
+$xMetadata = $this->getAttributes(Annotated::class, ['withBags']);
87
+$bExcluded = $xMetadata->isExcluded();
88
+$aProperties = $xMetadata->getProperties();
89
+
90
+$this->assertFalse($bExcluded);
91
+
92
+$this->assertCount(1, $aProperties);
93
+$this->assertArrayHasKey('withBags', $aProperties);
94
+$this->assertCount(1, $aProperties['withBags']);
95
+$this->assertCount(2, $aProperties['withBags']['bags']);
96
+$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
97
+$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
98
+}
99
+
100
+/**
101 101
      * @throws SetupException
102 102
      */
103
-    public function testServerCallbacksAnnotation()
104
-    {
105
-        $xMetadata = $this->getAttributes(Annotated::class,
106
-            ['cbSingle', 'cbMultiple', 'cbParams']);
107
-        $bExcluded = $xMetadata->isExcluded();
108
-        $aProperties = $xMetadata->getProperties();
109
-
110
-        $this->assertFalse($bExcluded);
111
-
112
-        $this->assertCount(3, $aProperties);
113
-        $this->assertArrayHasKey('cbSingle', $aProperties);
114
-        $this->assertArrayHasKey('cbMultiple', $aProperties);
115
-        $this->assertArrayHasKey('cbParams', $aProperties);
116
-
117
-        $this->assertCount(1, $aProperties['cbSingle']['__before']);
118
-        $this->assertCount(2, $aProperties['cbMultiple']['__before']);
119
-        $this->assertCount(2, $aProperties['cbParams']['__before']);
120
-        $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
121
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
122
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
123
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
124
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
125
-        $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
126
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
127
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
128
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
129
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
130
-
131
-        $this->assertCount(1, $aProperties['cbSingle']['__after']);
132
-        $this->assertCount(3, $aProperties['cbMultiple']['__after']);
133
-        $this->assertCount(1, $aProperties['cbParams']['__after']);
134
-        $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
135
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
136
-        $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
137
-        $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
138
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
139
-        $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
140
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
141
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
142
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
143
-        $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
144
-    }
145
-
146
-    /**
103
+public function testServerCallbacksAnnotation()
104
+{
105
+$xMetadata = $this->getAttributes(Annotated::class,
106
+['cbSingle', 'cbMultiple', 'cbParams']);
107
+$bExcluded = $xMetadata->isExcluded();
108
+$aProperties = $xMetadata->getProperties();
109
+
110
+$this->assertFalse($bExcluded);
111
+
112
+$this->assertCount(3, $aProperties);
113
+$this->assertArrayHasKey('cbSingle', $aProperties);
114
+$this->assertArrayHasKey('cbMultiple', $aProperties);
115
+$this->assertArrayHasKey('cbParams', $aProperties);
116
+
117
+$this->assertCount(1, $aProperties['cbSingle']['__before']);
118
+$this->assertCount(2, $aProperties['cbMultiple']['__before']);
119
+$this->assertCount(2, $aProperties['cbParams']['__before']);
120
+$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
121
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
122
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
123
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
124
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
125
+$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
126
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
127
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
128
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
129
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
130
+
131
+$this->assertCount(1, $aProperties['cbSingle']['__after']);
132
+$this->assertCount(3, $aProperties['cbMultiple']['__after']);
133
+$this->assertCount(1, $aProperties['cbParams']['__after']);
134
+$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
135
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
136
+$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
137
+$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
138
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
139
+$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
140
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
141
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
142
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
143
+$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
144
+}
145
+
146
+/**
147 147
      * @throws SetupException
148 148
      */
149
-    public function testContainerAnnotation()
150
-    {
151
-        $xMetadata = $this->getAttributes(Annotated::class, ['di1', 'di2']);
152
-        $bExcluded = $xMetadata->isExcluded();
153
-        $aProperties = $xMetadata->getProperties();
154
-
155
-        $this->assertFalse($bExcluded);
156
-
157
-        $this->assertCount(2, $aProperties);
158
-        $this->assertArrayHasKey('di1', $aProperties);
159
-        $this->assertArrayHasKey('di2', $aProperties);
160
-        $this->assertCount(2, $aProperties['di1']['__di']);
161
-        $this->assertCount(2, $aProperties['di2']['__di']);
162
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
163
-        $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
164
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
165
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
166
-    }
167
-
168
-    /**
149
+public function testContainerAnnotation()
150
+{
151
+$xMetadata = $this->getAttributes(Annotated::class, ['di1', 'di2']);
152
+$bExcluded = $xMetadata->isExcluded();
153
+$aProperties = $xMetadata->getProperties();
154
+
155
+$this->assertFalse($bExcluded);
156
+
157
+$this->assertCount(2, $aProperties);
158
+$this->assertArrayHasKey('di1', $aProperties);
159
+$this->assertArrayHasKey('di2', $aProperties);
160
+$this->assertCount(2, $aProperties['di1']['__di']);
161
+$this->assertCount(2, $aProperties['di2']['__di']);
162
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
163
+$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
164
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
165
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
166
+}
167
+
168
+/**
169 169
      * @throws SetupException
170 170
      */
171
-    public function testClassAnnotation()
172
-    {
173
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
174
-        $bExcluded = $xMetadata->isExcluded();
175
-        $aProperties = $xMetadata->getProperties();
176
-
177
-        $this->assertFalse($bExcluded);
178
-
179
-        $this->assertCount(1, $aProperties);
180
-        $this->assertArrayHasKey('*', $aProperties);
181
-        $this->assertCount(5, $aProperties['*']);
182
-        $this->assertArrayHasKey('bags', $aProperties['*']);
183
-        $this->assertArrayHasKey('callback', $aProperties['*']);
184
-        $this->assertArrayHasKey('__before', $aProperties['*']);
185
-        $this->assertArrayHasKey('__after', $aProperties['*']);
186
-    }
187
-
188
-    /**
171
+public function testClassAnnotation()
172
+{
173
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
174
+$bExcluded = $xMetadata->isExcluded();
175
+$aProperties = $xMetadata->getProperties();
176
+
177
+$this->assertFalse($bExcluded);
178
+
179
+$this->assertCount(1, $aProperties);
180
+$this->assertArrayHasKey('*', $aProperties);
181
+$this->assertCount(5, $aProperties['*']);
182
+$this->assertArrayHasKey('bags', $aProperties['*']);
183
+$this->assertArrayHasKey('callback', $aProperties['*']);
184
+$this->assertArrayHasKey('__before', $aProperties['*']);
185
+$this->assertArrayHasKey('__after', $aProperties['*']);
186
+}
187
+
188
+/**
189 189
      * @throws SetupException
190 190
      */
191
-    public function testClassBagsAnnotation()
192
-    {
193
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
194
-        $aProperties = $xMetadata->getProperties();
191
+public function testClassBagsAnnotation()
192
+{
193
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
194
+$aProperties = $xMetadata->getProperties();
195 195
 
196
-        $this->assertCount(2, $aProperties['*']['bags']);
197
-        $this->assertEquals('user.name', $aProperties['*']['bags'][0]);
198
-        $this->assertEquals('page.number', $aProperties['*']['bags'][1]);
199
-    }
196
+$this->assertCount(2, $aProperties['*']['bags']);
197
+$this->assertEquals('user.name', $aProperties['*']['bags'][0]);
198
+$this->assertEquals('page.number', $aProperties['*']['bags'][1]);
199
+}
200 200
 
201
-    /**
201
+/**
202 202
      * @throws SetupException
203 203
      */
204
-    public function testClassCallbackAnnotation()
205
-    {
206
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
207
-        $aProperties = $xMetadata->getProperties();
204
+public function testClassCallbackAnnotation()
205
+{
206
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
207
+$aProperties = $xMetadata->getProperties();
208 208
 
209
-        $this->assertIsArray($aProperties['*']['callback']);
210
-        $this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]);
211
-    }
209
+$this->assertIsArray($aProperties['*']['callback']);
210
+$this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]);
211
+}
212 212
 
213
-    /**
213
+/**
214 214
      * @throws SetupException
215 215
      */
216
-    public function testClassBeforeAnnotation()
217
-    {
218
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
219
-        $aProperties = $xMetadata->getProperties();
220
-
221
-        $this->assertCount(2, $aProperties['*']['__before']);
222
-        $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
223
-        $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
224
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
225
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
226
-    }
227
-
228
-    /**
216
+public function testClassBeforeAnnotation()
217
+{
218
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
219
+$aProperties = $xMetadata->getProperties();
220
+
221
+$this->assertCount(2, $aProperties['*']['__before']);
222
+$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
223
+$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
224
+$this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
225
+$this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
226
+}
227
+
228
+/**
229 229
      * @throws SetupException
230 230
      */
231
-    public function testClassAfterAnnotation()
232
-    {
233
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
234
-        $aProperties = $xMetadata->getProperties();
235
-
236
-        $this->assertCount(3, $aProperties['*']['__after']);
237
-        $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
238
-        $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
239
-        $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
240
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
241
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
242
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
243
-    }
244
-
245
-    /**
231
+public function testClassAfterAnnotation()
232
+{
233
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
234
+$aProperties = $xMetadata->getProperties();
235
+
236
+$this->assertCount(3, $aProperties['*']['__after']);
237
+$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
238
+$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
239
+$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
240
+$this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
241
+$this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
242
+$this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
243
+}
244
+
245
+/**
246 246
      * @throws SetupException
247 247
      */
248
-    public function testClassDiAnnotation()
249
-    {
250
-        $xMetadata = $this->getAttributes(ClassAnnotated::class, []);
251
-        $aProperties = $xMetadata->getProperties();
252
-
253
-        $this->assertCount(3, $aProperties['*']['__di']);
254
-        $this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
255
-        $this->assertArrayHasKey('textService', $aProperties['*']['__di']);
256
-        $this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
257
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
258
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
259
-        $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']);
260
-    }
261
-
262
-    /**
248
+public function testClassDiAnnotation()
249
+{
250
+$xMetadata = $this->getAttributes(ClassAnnotated::class, []);
251
+$aProperties = $xMetadata->getProperties();
252
+
253
+$this->assertCount(3, $aProperties['*']['__di']);
254
+$this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
255
+$this->assertArrayHasKey('textService', $aProperties['*']['__di']);
256
+$this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
257
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
258
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
259
+$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']);
260
+}
261
+
262
+/**
263 263
      * @throws SetupException
264 264
      */
265
-    public function testClassExcludeAnnotation()
266
-    {
267
-        $xMetadata = $this->getAttributes(ClassExcluded::class,
268
-            ['doNot', 'withBags', 'cbSingle']);
269
-        $bExcluded = $xMetadata->isExcluded();
270
-        $aProperties = $xMetadata->getProperties();
271
-        $aExcluded = $xMetadata->getExceptMethods();
272
-
273
-        $xData = $xMetadata->exclude();
274
-        $this->assertTrue($xData->getValue());
275
-        $this->assertEquals('protected', $xData->getName());
276
-
277
-        $this->assertTrue($bExcluded);
278
-        $this->assertEmpty($aProperties);
279
-        $this->assertEmpty($aExcluded);
280
-    }
281
-
282
-    public function testExcludeAnnotationError()
283
-    {
284
-        $this->expectException(SetupException::class);
285
-        $this->getAttributes(Annotated::class, ['doNotError']);
286
-    }
287
-
288
-    public function testDatabagAnnotationError()
289
-    {
290
-        $this->expectException(SetupException::class);
291
-        $this->getAttributes(Annotated::class, ['withBagsError']);
292
-    }
293
-
294
-    public function testUploadAnnotationWrongName()
295
-    {
296
-        $this->expectException(SetupException::class);
297
-        $this->getAttributes(Annotated::class, ['saveFilesWrongName']);
298
-    }
299
-
300
-    public function testUploadAnnotationMultiple()
301
-    {
302
-        $this->expectException(SetupException::class);
303
-        $this->getAttributes(Annotated::class, ['saveFilesMultiple']);
304
-    }
305
-
306
-    public function testCallbacksBeforeAnnotationNoCall()
307
-    {
308
-        $this->expectException(SetupException::class);
309
-        $this->getAttributes(Annotated::class, ['cbBeforeNoCall']);
310
-    }
311
-
312
-    public function testCallbacksBeforeAnnotationUnknownAttr()
313
-    {
314
-        $this->expectException(SetupException::class);
315
-        $this->getAttributes(Annotated::class, ['cbBeforeUnknownAttr']);
316
-    }
317
-
318
-    public function testCallbacksBeforeAnnotationWrongAttrType()
319
-    {
320
-        $this->expectException(SetupException::class);
321
-        $this->getAttributes(Annotated::class, ['cbBeforeWrongAttrType']);
322
-    }
323
-
324
-    public function testCallbacksAfterAnnotationNoCall()
325
-    {
326
-        $this->expectException(SetupException::class);
327
-        $this->getAttributes(Annotated::class, ['cbAfterNoCall']);
328
-    }
329
-
330
-    public function testCallbacksAfterAnnotationUnknownAttr()
331
-    {
332
-        $this->expectException(SetupException::class);
333
-        $this->getAttributes(Annotated::class, ['cbAfterUnknownAttr']);
334
-    }
335
-
336
-    public function testCallbacksAfterAnnotationWrongAttrType()
337
-    {
338
-        $this->expectException(SetupException::class);
339
-        $this->getAttributes(Annotated::class, ['cbAfterWrongAttrType']);
340
-    }
341
-
342
-    public function testContainerAnnotationUnknownAttr()
343
-    {
344
-        $this->expectException(SetupException::class);
345
-        $this->getAttributes(Annotated::class, ['diUnknownAttr']);
346
-    }
347
-
348
-    public function testContainerAnnotationWrongAttrType()
349
-    {
350
-        $this->expectException(SetupException::class);
351
-        $this->getAttributes(Annotated::class, ['diWrongAttrType']);
352
-    }
353
-
354
-    public function testContainerAnnotationWrongClassType()
355
-    {
356
-        $this->expectException(SetupException::class);
357
-        $this->getAttributes(Annotated::class, ['diWrongClassType']);
358
-    }
359
-
360
-    public function testContainerAnnotationWrongVarCount()
361
-    {
362
-        $this->expectException(SetupException::class);
363
-        $this->getAttributes(Annotated::class, ['diWrongVarCount']);
364
-    }
365
-
366
-    public function testContainerErrorTwiceOnProp()
367
-    {
368
-        $this->expectException(SetupException::class);
369
-        $this->getAttributes(ContainerError::class, [], ['prop']);
370
-    }
371
-
372
-    public function testCallbackErrorNoName()
373
-    {
374
-        $this->expectException(SetupException::class);
375
-        $this->getAttributes(CallbackError::class, ['noName']);
376
-    }
377
-
378
-    public function testCallbackErrorWrongNameType()
379
-    {
380
-        $this->expectException(SetupException::class);
381
-        $this->getAttributes(CallbackError::class, ['wrongNameType']);
382
-    }
383
-
384
-    public function testCallbackErrorWrongNameAttr()
385
-    {
386
-        $this->expectException(SetupException::class);
387
-        $this->getAttributes(CallbackError::class, ['wrongNameAttr']);
388
-    }
389
-
390
-    public function testCallbackErrorNameWithSpace()
391
-    {
392
-        $this->expectException(SetupException::class);
393
-        $this->getAttributes(CallbackError::class, ['nameWithSpace']);
394
-    }
395
-
396
-    public function testCallbackErrorStartWithInt()
397
-    {
398
-        $this->expectException(SetupException::class);
399
-        $this->getAttributes(CallbackError::class, ['startWithInt']);
400
-    }
265
+public function testClassExcludeAnnotation()
266
+{
267
+$xMetadata = $this->getAttributes(ClassExcluded::class,
268
+['doNot', 'withBags', 'cbSingle']);
269
+$bExcluded = $xMetadata->isExcluded();
270
+$aProperties = $xMetadata->getProperties();
271
+$aExcluded = $xMetadata->getExceptMethods();
272
+
273
+$xData = $xMetadata->exclude();
274
+$this->assertTrue($xData->getValue());
275
+$this->assertEquals('protected', $xData->getName());
276
+
277
+$this->assertTrue($bExcluded);
278
+$this->assertEmpty($aProperties);
279
+$this->assertEmpty($aExcluded);
280
+}
281
+
282
+public function testExcludeAnnotationError()
283
+{
284
+$this->expectException(SetupException::class);
285
+$this->getAttributes(Annotated::class, ['doNotError']);
286
+}
287
+
288
+public function testDatabagAnnotationError()
289
+{
290
+$this->expectException(SetupException::class);
291
+$this->getAttributes(Annotated::class, ['withBagsError']);
292
+}
293
+
294
+public function testUploadAnnotationWrongName()
295
+{
296
+$this->expectException(SetupException::class);
297
+$this->getAttributes(Annotated::class, ['saveFilesWrongName']);
298
+}
299
+
300
+public function testUploadAnnotationMultiple()
301
+{
302
+$this->expectException(SetupException::class);
303
+$this->getAttributes(Annotated::class, ['saveFilesMultiple']);
304
+}
305
+
306
+public function testCallbacksBeforeAnnotationNoCall()
307
+{
308
+$this->expectException(SetupException::class);
309
+$this->getAttributes(Annotated::class, ['cbBeforeNoCall']);
310
+}
311
+
312
+public function testCallbacksBeforeAnnotationUnknownAttr()
313
+{
314
+$this->expectException(SetupException::class);
315
+$this->getAttributes(Annotated::class, ['cbBeforeUnknownAttr']);
316
+}
317
+
318
+public function testCallbacksBeforeAnnotationWrongAttrType()
319
+{
320
+$this->expectException(SetupException::class);
321
+$this->getAttributes(Annotated::class, ['cbBeforeWrongAttrType']);
322
+}
323
+
324
+public function testCallbacksAfterAnnotationNoCall()
325
+{
326
+$this->expectException(SetupException::class);
327
+$this->getAttributes(Annotated::class, ['cbAfterNoCall']);
328
+}
329
+
330
+public function testCallbacksAfterAnnotationUnknownAttr()
331
+{
332
+$this->expectException(SetupException::class);
333
+$this->getAttributes(Annotated::class, ['cbAfterUnknownAttr']);
334
+}
335
+
336
+public function testCallbacksAfterAnnotationWrongAttrType()
337
+{
338
+$this->expectException(SetupException::class);
339
+$this->getAttributes(Annotated::class, ['cbAfterWrongAttrType']);
340
+}
341
+
342
+public function testContainerAnnotationUnknownAttr()
343
+{
344
+$this->expectException(SetupException::class);
345
+$this->getAttributes(Annotated::class, ['diUnknownAttr']);
346
+}
347
+
348
+public function testContainerAnnotationWrongAttrType()
349
+{
350
+$this->expectException(SetupException::class);
351
+$this->getAttributes(Annotated::class, ['diWrongAttrType']);
352
+}
353
+
354
+public function testContainerAnnotationWrongClassType()
355
+{
356
+$this->expectException(SetupException::class);
357
+$this->getAttributes(Annotated::class, ['diWrongClassType']);
358
+}
359
+
360
+public function testContainerAnnotationWrongVarCount()
361
+{
362
+$this->expectException(SetupException::class);
363
+$this->getAttributes(Annotated::class, ['diWrongVarCount']);
364
+}
365
+
366
+public function testContainerErrorTwiceOnProp()
367
+{
368
+$this->expectException(SetupException::class);
369
+$this->getAttributes(ContainerError::class, [], ['prop']);
370
+}
371
+
372
+public function testCallbackErrorNoName()
373
+{
374
+$this->expectException(SetupException::class);
375
+$this->getAttributes(CallbackError::class, ['noName']);
376
+}
377
+
378
+public function testCallbackErrorWrongNameType()
379
+{
380
+$this->expectException(SetupException::class);
381
+$this->getAttributes(CallbackError::class, ['wrongNameType']);
382
+}
383
+
384
+public function testCallbackErrorWrongNameAttr()
385
+{
386
+$this->expectException(SetupException::class);
387
+$this->getAttributes(CallbackError::class, ['wrongNameAttr']);
388
+}
389
+
390
+public function testCallbackErrorNameWithSpace()
391
+{
392
+$this->expectException(SetupException::class);
393
+$this->getAttributes(CallbackError::class, ['nameWithSpace']);
394
+}
395
+
396
+public function testCallbackErrorStartWithInt()
397
+{
398
+$this->expectException(SetupException::class);
399
+$this->getAttributes(CallbackError::class, ['startWithInt']);
400
+}
401 401
 }
Please login to merge, or discard this patch.
jaxon-annotations/src/Annotation/AbstractAnnotation.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
 abstract class AbstractAnnotation extends Annotation implements IAnnotationParser
22 22
 {
23
-    /**
23
+/**
24 24
      * Save the annotation value
25 25
      *
26 26
      * @param Metadata $xMetadata
@@ -28,5 +28,5 @@  discard block
 block discarded – undo
28 28
      *
29 29
      * @return void
30 30
      */
31
-    abstract public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void;
31
+abstract public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void;
32 32
 }
Please login to merge, or discard this patch.
jaxon-annotations/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-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
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.
Switch Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -22,213 +22,213 @@
 block discarded – undo
22 22
 
23 23
 class Metadata
24 24
 {
25
-    /**
25
+/**
26 26
      * @var array<string, array<string, Data\AbstractData>>
27 27
      */
28
-    private array $aAttributes = [
29
-        'exclude' => [],
30
-        'export' => [],
31
-        'container' => [],
32
-        'databag' => [],
33
-        'callback' => [],
34
-        'before' => [],
35
-        'after' => [],
36
-        'upload' => [],
37
-    ];
38
-
39
-    /**
28
+private array $aAttributes = [
29
+'exclude' => [],
30
+'export' => [],
31
+'container' => [],
32
+'databag' => [],
33
+'callback' => [],
34
+'before' => [],
35
+'after' => [],
36
+'upload' => [],
37
+];
38
+
39
+/**
40 40
      * @return array<string, array<string, Data\AbstractData>>
41 41
      */
42
-    public function getAttributes(): array
43
-    {
44
-        return $this->aAttributes;
45
-    }
42
+public function getAttributes(): array
43
+{
44
+return $this->aAttributes;
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @param string $sMethod
49 49
      *
50 50
      * @return Data\ExcludeData
51 51
      */
52
-    public function exclude(string $sMethod = '*'): Data\ExcludeData
53
-    {
54
-        return $this->aAttributes['exclude'][$sMethod] ??
55
-            $this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
56
-    }
52
+public function exclude(string $sMethod = '*'): Data\ExcludeData
53
+{
54
+return $this->aAttributes['exclude'][$sMethod] ??
55
+$this->aAttributes['exclude'][$sMethod] = new Data\ExcludeData();
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * @param string $sMethod
60 60
      *
61 61
      * @return Data\ExportData
62 62
      */
63
-    public function export(string $sMethod = '*'): Data\ExportData
64
-    {
65
-        $sMethod = '*'; // On classes only
66
-        return $this->aAttributes['export'][$sMethod] ??
67
-            $this->aAttributes['export'][$sMethod] = new Data\ExportData();
68
-    }
63
+public function export(string $sMethod = '*'): Data\ExportData
64
+{
65
+$sMethod = '*'; // On classes only
66
+return $this->aAttributes['export'][$sMethod] ??
67
+$this->aAttributes['export'][$sMethod] = new Data\ExportData();
68
+}
69 69
 
70
-    /**
70
+/**
71 71
      * @param string $sMethod
72 72
      *
73 73
      * @return Data\ContainerData
74 74
      */
75
-    public function container(string $sMethod = '*'): Data\ContainerData
76
-    {
77
-        return $this->aAttributes['container'][$sMethod] ??
78
-            $this->aAttributes['container'][$sMethod] = new Data\ContainerData();
79
-    }
75
+public function container(string $sMethod = '*'): Data\ContainerData
76
+{
77
+return $this->aAttributes['container'][$sMethod] ??
78
+$this->aAttributes['container'][$sMethod] = new Data\ContainerData();
79
+}
80 80
 
81
-    /**
81
+/**
82 82
      * @param string $sMethod
83 83
      *
84 84
      * @return Data\DatabagData
85 85
      */
86
-    public function databag(string $sMethod = '*'): Data\DatabagData
87
-    {
88
-        return $this->aAttributes['databag'][$sMethod] ??
89
-            $this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
90
-    }
86
+public function databag(string $sMethod = '*'): Data\DatabagData
87
+{
88
+return $this->aAttributes['databag'][$sMethod] ??
89
+$this->aAttributes['databag'][$sMethod] = new Data\DatabagData();
90
+}
91 91
 
92
-    /**
92
+/**
93 93
      * @param string $sMethod
94 94
      *
95 95
      * @return Data\CallbackData
96 96
      */
97
-    public function callback(string $sMethod = '*'): Data\CallbackData
98
-    {
99
-        return $this->aAttributes['callback'][$sMethod] ??
100
-            $this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
101
-    }
97
+public function callback(string $sMethod = '*'): Data\CallbackData
98
+{
99
+return $this->aAttributes['callback'][$sMethod] ??
100
+$this->aAttributes['callback'][$sMethod] = new Data\CallbackData();
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * @param string $sMethod
105 105
      *
106 106
      * @return Data\BeforeData
107 107
      */
108
-    public function before(string $sMethod = '*'): Data\BeforeData
109
-    {
110
-        return $this->aAttributes['before'][$sMethod] ??
111
-            $this->aAttributes['before'][$sMethod] = new Data\BeforeData();
112
-    }
108
+public function before(string $sMethod = '*'): Data\BeforeData
109
+{
110
+return $this->aAttributes['before'][$sMethod] ??
111
+$this->aAttributes['before'][$sMethod] = new Data\BeforeData();
112
+}
113 113
 
114
-    /**
114
+/**
115 115
      * @param string $sMethod
116 116
      *
117 117
      * @return Data\AfterData
118 118
      */
119
-    public function after(string $sMethod = '*'): Data\AfterData
120
-    {
121
-        return $this->aAttributes['after'][$sMethod] ??
122
-            $this->aAttributes['after'][$sMethod] = new Data\AfterData();
123
-    }
119
+public function after(string $sMethod = '*'): Data\AfterData
120
+{
121
+return $this->aAttributes['after'][$sMethod] ??
122
+$this->aAttributes['after'][$sMethod] = new Data\AfterData();
123
+}
124 124
 
125
-    /**
125
+/**
126 126
      * @param string $sMethod
127 127
      *
128 128
      * @return Data\UploadData
129 129
      */
130
-    public function upload(string $sMethod = '*'): Data\UploadData
131
-    {
132
-        return $this->aAttributes['upload'][$sMethod] ??
133
-            $this->aAttributes['upload'][$sMethod] = new Data\UploadData();
134
-    }
130
+public function upload(string $sMethod = '*'): Data\UploadData
131
+{
132
+return $this->aAttributes['upload'][$sMethod] ??
133
+$this->aAttributes['upload'][$sMethod] = new Data\UploadData();
134
+}
135 135
 
136
-    /**
136
+/**
137 137
      * True if the class is excluded
138 138
      *
139 139
      * @return bool
140 140
      */
141
-    public function isExcluded(): bool
142
-    {
143
-        $xData = $this->aAttributes['exclude']['*'] ?? null;
144
-        return $xData !== null && $xData->getValue() === true;
145
-    }
141
+public function isExcluded(): bool
142
+{
143
+$xData = $this->aAttributes['exclude']['*'] ?? null;
144
+return $xData !== null && $xData->getValue() === true;
145
+}
146 146
 
147
-    /**
147
+/**
148 148
      * Get the properties of the class methods
149 149
      *
150 150
      * @return array
151 151
      */
152
-    public function getProperties(): array
152
+public function getProperties(): array
153
+{
154
+$aProperties = [];
155
+$aClassProperties = [];
156
+foreach($this->aAttributes as $sType => $aValues)
157
+{
158
+if($sType === 'exclude')
159
+{
160
+    continue;
161
+}
162
+
163
+foreach($aValues as $sMethod => $xData)
164
+{
165
+    if($sMethod === '*')
153 166
     {
154
-        $aProperties = [];
155
-        $aClassProperties = [];
156
-        foreach($this->aAttributes as $sType => $aValues)
157
-        {
158
-            if($sType === 'exclude')
159
-            {
160
-                continue;
161
-            }
162
-
163
-            foreach($aValues as $sMethod => $xData)
164
-            {
165
-                if($sMethod === '*')
166
-                {
167
-                    $aClassProperties[$xData->getName()] = $xData->getValue();
168
-                    continue;
169
-                }
170
-                $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
171
-            }
172
-        }
173
-
174
-        if(count($aClassProperties) > 0)
175
-        {
176
-            $aProperties['*'] = $aClassProperties;
177
-        }
178
-
179
-        return $aProperties;
167
+        $aClassProperties[$xData->getName()] = $xData->getValue();
168
+        continue;
180 169
     }
170
+    $aProperties[$sMethod][$xData->getName()] = $xData->getValue();
171
+}
172
+}
181 173
 
182
-    /**
174
+if(count($aClassProperties) > 0)
175
+{
176
+$aProperties['*'] = $aClassProperties;
177
+}
178
+
179
+return $aProperties;
180
+}
181
+
182
+/**
183 183
      * Get the methods in the export attributes
184 184
      *
185 185
      * @return array
186 186
      */
187
-    public function getExportMethods(): array
188
-    {
189
-        /** @var array<Data\ExcludeData> */
190
-        $aAttributes = $this->aAttributes['exclude'];
191
-        $aExcludeMethods = array_keys($aAttributes);
192
-        $aExcludeMethods = array_values(array_filter($aExcludeMethods,
193
-            fn(string $sName) => $sName !== '*' &&
194
-                $aAttributes[$sName]->getValue() === true));
195
-
196
-        /** @var Data\ExportData|null */
197
-        $xExportData = $this->aAttributes['export']['*'] ?? null;
198
-        $aExportMethods = $xExportData?->getValue() ?? [];
199
-
200
-        $aExceptMethods = $aExportMethods['except'] ?? [];
201
-        $aExportMethods['except'] = array_merge($aExcludeMethods, $aExceptMethods);
202
-        return $aExportMethods;
203
-    }
187
+public function getExportMethods(): array
188
+{
189
+/** @var array<Data\ExcludeData> */
190
+$aAttributes = $this->aAttributes['exclude'];
191
+$aExcludeMethods = array_keys($aAttributes);
192
+$aExcludeMethods = array_values(array_filter($aExcludeMethods,
193
+fn(string $sName) => $sName !== '*' &&
194
+    $aAttributes[$sName]->getValue() === true));
195
+
196
+/** @var Data\ExportData|null */
197
+$xExportData = $this->aAttributes['export']['*'] ?? null;
198
+$aExportMethods = $xExportData?->getValue() ?? [];
199
+
200
+$aExceptMethods = $aExportMethods['except'] ?? [];
201
+$aExportMethods['except'] = array_merge($aExcludeMethods, $aExceptMethods);
202
+return $aExportMethods;
203
+}
204 204
 
205
-    /**
205
+/**
206 206
      * Get the exluded methods
207 207
      *
208 208
      * @return array
209 209
      */
210
-    public function getExceptMethods(): array
211
-    {
212
-        return $this->getExportMethods()['except'];
213
-    }
210
+public function getExceptMethods(): array
211
+{
212
+return $this->getExportMethods()['except'];
213
+}
214 214
 
215
-    /**
215
+/**
216 216
      * Get the export base methods
217 217
      *
218 218
      * @return array
219 219
      */
220
-    public function getExportBaseMethods(): array
221
-    {
222
-        return $this->getExportMethods()['base'] ?? [];
223
-    }
220
+public function getExportBaseMethods(): array
221
+{
222
+return $this->getExportMethods()['base'] ?? [];
223
+}
224 224
 
225
-    /**
225
+/**
226 226
      * Get the export only methods
227 227
      *
228 228
      * @return array
229 229
      */
230
-    public function getExportOnlyMethods(): array
231
-    {
232
-        return $this->getExportMethods()['only'] ?? [];
233
-    }
230
+public function getExportOnlyMethods(): array
231
+{
232
+return $this->getExportMethods()['only'] ?? [];
233
+}
234 234
 }
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/App/Metadata/MetadataCache.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@
 block discarded – undo
51 51
         $sMetadataVar = '$xMetadata';
52 52
         $sDataVar = '$xData';
53 53
         $aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
54
-        foreach($xMetadata->getAttributes() as $sType => $aValues)
54
+        foreach ($xMetadata->getAttributes() as $sType => $aValues)
55 55
         {
56
-            foreach($aValues as $sMethod => $xData)
56
+            foreach ($aValues as $sMethod => $xData)
57 57
             {
58 58
                 $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
59
-                foreach($xData->encode($sDataVar) as $sCall)
59
+                foreach ($xData->encode($sDataVar) as $sCall)
60 60
                 {
61 61
                     $aCalls[] = $sCall;
62 62
                 }
Please login to merge, or discard this patch.
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -28,60 +28,60 @@  discard block
 block discarded – undo
28 28
 
29 29
 class MetadataCache
30 30
 {
31
-    /**
31
+/**
32 32
      * @param string $sCacheDir
33 33
      */
34
-    public function __construct(private string $sCacheDir)
35
-    {}
34
+public function __construct(private string $sCacheDir)
35
+{}
36 36
 
37
-    /**
37
+/**
38 38
      * @param string $sClass
39 39
      *
40 40
      * @return string
41 41
      */
42
-    private function filepath(string $sClass): string
43
-    {
44
-        $sFilename = trim(str_replace(['\\', '.'], DIRECTORY_SEPARATOR,
45
-            strtolower($sClass)), DIRECTORY_SEPARATOR);
46
-        return rtrim($this->sCacheDir, "/\\") . DIRECTORY_SEPARATOR .
47
-            "metadata" . DIRECTORY_SEPARATOR . "{$sFilename}.php";
48
-    }
42
+private function filepath(string $sClass): string
43
+{
44
+$sFilename = trim(str_replace(['\\', '.'], DIRECTORY_SEPARATOR,
45
+strtolower($sClass)), DIRECTORY_SEPARATOR);
46
+return rtrim($this->sCacheDir, "/\\") . DIRECTORY_SEPARATOR .
47
+"metadata" . DIRECTORY_SEPARATOR . "{$sFilename}.php";
48
+}
49 49
 
50
-    /**
50
+/**
51 51
      * Generate the PHP code to create a metadata object.
52 52
      *
53 53
      * @return array
54 54
      */
55
-    private function encode(Metadata $xMetadata): array
55
+private function encode(Metadata $xMetadata): array
56
+{
57
+$sMetadataVar = '$xMetadata';
58
+$sDataVar = '$xData';
59
+$aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
60
+foreach($xMetadata->getAttributes() as $sType => $aValues)
61
+{
62
+foreach($aValues as $sMethod => $xData)
63
+{
64
+    $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
65
+    foreach($xData->encode($sDataVar) as $sCall)
56 66
     {
57
-        $sMetadataVar = '$xMetadata';
58
-        $sDataVar = '$xData';
59
-        $aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
60
-        foreach($xMetadata->getAttributes() as $sType => $aValues)
61
-        {
62
-            foreach($aValues as $sMethod => $xData)
63
-            {
64
-                $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
65
-                foreach($xData->encode($sDataVar) as $sCall)
66
-                {
67
-                    $aCalls[] = $sCall;
68
-                }
69
-            }
70
-        }
71
-        $aCalls[] = "return $sMetadataVar;";
72
-        return $aCalls;
67
+        $aCalls[] = $sCall;
73 68
     }
69
+}
70
+}
71
+$aCalls[] = "return $sMetadataVar;";
72
+return $aCalls;
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * @param string $sClass
77 77
      * @param Metadata $xMetadata
78 78
      *
79 79
      * @return void
80 80
      */
81
-    public function save(string $sClass, Metadata $xMetadata): void
82
-    {
83
-        $sDataCode = implode("\n    ", $this->encode($xMetadata));
84
-        $sPhpCode = <<<CODE
81
+public function save(string $sClass, Metadata $xMetadata): void
82
+{
83
+$sDataCode = implode("\n    ", $this->encode($xMetadata));
84
+$sPhpCode = <<<CODE
85 85
 <?php
86 86
 
87 87
 return function() {
@@ -89,21 +89,21 @@  discard block
 block discarded – undo
89 89
 };
90 90
 
91 91
 CODE;
92
-        // Recursively create the directories.
93
-        $sPath = $this->filepath($sClass);
94
-        @mkdir(dirname($sPath), 0755, true);
95
-        file_put_contents($sPath, $sPhpCode);
96
-    }
92
+// Recursively create the directories.
93
+$sPath = $this->filepath($sClass);
94
+@mkdir(dirname($sPath), 0755, true);
95
+file_put_contents($sPath, $sPhpCode);
96
+}
97 97
 
98
-    /**
98
+/**
99 99
      * @param string $sClass
100 100
      *
101 101
      * @return Metadata|null
102 102
      */
103
-    public function read(string $sClass): ?Metadata
104
-    {
105
-        $sPath = $this->filepath($sClass);
106
-        $fCreator = file_exists($sPath) ? require $sPath : null;
107
-        return $fCreator instanceof Closure ? $fCreator() : null;
108
-    }
103
+public function read(string $sClass): ?Metadata
104
+{
105
+$sPath = $this->filepath($sClass);
106
+$fCreator = file_exists($sPath) ? require $sPath : null;
107
+return $fCreator instanceof Closure ? $fCreator() : null;
108
+}
109 109
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/ContainerData.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      */
52 52
     protected function validateAttr(string $sAttr): void
53 53
     {
54
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
54
+        if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
55 55
         {
56 56
             return;
57 57
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     protected function validateClass(string $sClass): void
67 67
     {
68
-        if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
68
+        if (preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
69 69
         {
70 70
             return;
71 71
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     public function encode(string $sVarName): array
93 93
     {
94 94
         $aCalls = [];
95
-        foreach($this->aProperties as $sAttr => $sClass)
95
+        foreach ($this->aProperties as $sAttr => $sClass)
96 96
         {
97 97
             $aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');";
98 98
         }
Please login to merge, or discard this patch.
Switch Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -21,81 +21,81 @@
 block discarded – undo
21 21
 
22 22
 class ContainerData extends AbstractData
23 23
 {
24
-    /**
24
+/**
25 25
      * The properties to get from the container
26 26
      *
27 27
      * @var array
28 28
      */
29
-    protected $aProperties = [];
29
+protected $aProperties = [];
30 30
 
31
-    /**
31
+/**
32 32
      * @return string
33 33
      */
34
-    public function getName(): string
35
-    {
36
-        return '__di';
37
-    }
34
+public function getName(): string
35
+{
36
+return '__di';
37
+}
38 38
 
39
-    /**
39
+/**
40 40
      * @return mixed
41 41
      */
42
-    public function getValue(): mixed
43
-    {
44
-        return $this->aProperties;
45
-    }
42
+public function getValue(): mixed
43
+{
44
+return $this->aProperties;
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @param string $sAttr
49 49
      *
50 50
      * @return void
51 51
      */
52
-    protected function validateAttr(string $sAttr): void
53
-    {
54
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
55
-        {
56
-            return;
57
-        }
58
-        throw new SetupException("$sAttr is not a valid \"attr\" value for di");
59
-    }
52
+protected function validateAttr(string $sAttr): void
53
+{
54
+if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0)
55
+{
56
+return;
57
+}
58
+throw new SetupException("$sAttr is not a valid \"attr\" value for di");
59
+}
60 60
 
61
-    /**
61
+/**
62 62
      * @param string $sClass
63 63
      *
64 64
      * @return void
65 65
      */
66
-    protected function validateClass(string $sClass): void
67
-    {
68
-        if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
69
-        {
70
-            return;
71
-        }
72
-        throw new SetupException("$sClass is not a valid \"class\" value for di");
73
-    }
66
+protected function validateClass(string $sClass): void
67
+{
68
+if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0)
69
+{
70
+return;
71
+}
72
+throw new SetupException("$sClass is not a valid \"class\" value for di");
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * @param string $sAttr
77 77
      * @param string $sClass
78 78
      *
79 79
      * @return void
80 80
      */
81
-    public function addValue(string $sAttr, string $sClass): void
82
-    {
83
-        $this->validateAttr($sAttr);
84
-        $this->validateClass($sClass);
81
+public function addValue(string $sAttr, string $sClass): void
82
+{
83
+$this->validateAttr($sAttr);
84
+$this->validateClass($sClass);
85 85
 
86
-        $this->aProperties[$sAttr] = $sClass;
87
-    }
86
+$this->aProperties[$sAttr] = $sClass;
87
+}
88 88
 
89
-    /**
89
+/**
90 90
      * @inheritDoc
91 91
      */
92
-    public function encode(string $sVarName): array
93
-    {
94
-        $aCalls = [];
95
-        foreach($this->aProperties as $sAttr => $sClass)
96
-        {
97
-            $aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');";
98
-        }
99
-        return $aCalls;
100
-    }
92
+public function encode(string $sVarName): array
93
+{
94
+$aCalls = [];
95
+foreach($this->aProperties as $sAttr => $sClass)
96
+{
97
+$aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');";
98
+}
99
+return $aCalls;
100
+}
101 101
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/ResponsePluginInterface.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,17 +6,17 @@
 block discarded – undo
6 6
 
7 7
 interface ResponsePluginInterface
8 8
 {
9
-    /**
9
+/**
10 10
      * Get the attached response
11 11
      *
12 12
      * @return AbstractResponse|null
13 13
      */
14
-    public function response(): ?AbstractResponse;
14
+public function response(): ?AbstractResponse;
15 15
 
16
-    /**
16
+/**
17 17
      * @param AbstractResponse $xResponse   The response
18 18
      *
19 19
      * @return static
20 20
      */
21
-    public function initPlugin(AbstractResponse $xResponse): static;
21
+public function initPlugin(AbstractResponse $xResponse): static;
22 22
 }
Please login to merge, or discard this patch.