Passed
Push — main ( 8fa9e1...957ef0 )
by Thierry
06:37
created
jaxon-annotations/tests/Attr/Ajax/ClassExcluded.php 1 patch
Switch Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@
 block discarded – undo
9 9
  */
10 10
 class ClassExcluded extends FuncComponent
11 11
 {
12
-    /**
12
+/**
13 13
      * @exclude
14 14
      */
15
-    public function doNot()
16
-    {
17
-    }
15
+public function doNot()
16
+{
17
+}
18 18
 
19
-    /**
19
+/**
20 20
      * @databag('name' => 'user.name')
21 21
      * @databag('name' => 'page.number')
22 22
      */
23
-    public function withBags()
24
-    {
25
-    }
23
+public function withBags()
24
+{
25
+}
26 26
 
27
-    /**
27
+/**
28 28
      * @before('call' => 'funcBefore')
29 29
      * @after('call' => 'funcAfter')
30 30
      */
31
-    public function cbSingle()
32
-    {
33
-    }
31
+public function cbSingle()
32
+{
33
+}
34 34
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/Annotated.php 1 patch
Switch Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -7,176 +7,176 @@
 block discarded – undo
7 7
 
8 8
 class Annotated extends FuncComponent
9 9
 {
10
-    /**
10
+/**
11 11
      * @exclude
12 12
      */
13
-    public function doNot()
14
-    {
15
-    }
13
+public function doNot()
14
+{
15
+}
16 16
 
17
-    /**
17
+/**
18 18
      * @exclude(true)
19 19
      */
20
-    public function doNotBool()
21
-    {
22
-    }
20
+public function doNotBool()
21
+{
22
+}
23 23
 
24
-    /**
24
+/**
25 25
      * @exclude('Me')
26 26
      */
27
-    public function doNotError()
28
-    {
29
-    }
27
+public function doNotError()
28
+{
29
+}
30 30
 
31
-    /**
31
+/**
32 32
      * @databag('name' => 'user.name')
33 33
      * @databag('name' => 'page.number')
34 34
      */
35
-    public function withBags()
36
-    {
37
-    }
35
+public function withBags()
36
+{
37
+}
38 38
 
39
-    /**
39
+/**
40 40
      * @databag('mane' => 'user.name')
41 41
      * @databag('mane' => 'page.number')
42 42
      */
43
-    public function withBagsError()
44
-    {
45
-    }
43
+public function withBagsError()
44
+{
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @upload('field' => 'user-files')
49 49
      */
50
-    public function saveFiles()
51
-    {
52
-    }
50
+public function saveFiles()
51
+{
52
+}
53 53
 
54
-    /**
54
+/**
55 55
      * @upload('name' => 'user-files')
56 56
      */
57
-    public function saveFilesWrongName()
58
-    {
59
-    }
57
+public function saveFilesWrongName()
58
+{
59
+}
60 60
 
61
-    /**
61
+/**
62 62
      * @upload('field' => 'user-file1')
63 63
      * @upload('field' => 'user-file2')
64 64
      */
65
-    public function saveFilesMultiple()
66
-    {
67
-    }
65
+public function saveFilesMultiple()
66
+{
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * @before('call' => 'funcBefore')
71 71
      * @after('call' => 'funcAfter')
72 72
      */
73
-    public function cbSingle()
74
-    {
75
-    }
73
+public function cbSingle()
74
+{
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * @before('call' => 'funcBefore1')
79 79
      * @before('call' => 'funcBefore2')
80 80
      * @after('call' => 'funcAfter1')
81 81
      * @after('call' => 'funcAfter2')
82 82
      * @after('call' => 'funcAfter3')
83 83
      */
84
-    public function cbMultiple()
85
-    {
86
-    }
84
+public function cbMultiple()
85
+{
86
+}
87 87
 
88
-    /**
88
+/**
89 89
      * @before('call' => 'funcBefore1', 'with' => ['param1'])
90 90
      * @before('call' => 'funcBefore2', 'with' => ['param1', 'param2'])
91 91
      * @after('call' => 'funcAfter1', 'with' => ['param1', 'param2'])
92 92
      */
93
-    public function cbParams()
94
-    {
95
-    }
93
+public function cbParams()
94
+{
95
+}
96 96
 
97
-    /**
97
+/**
98 98
      * @di('attr' => 'colorService', 'class' => 'ColorService')
99 99
      * @di('attr' => 'fontService', 'class' => 'FontService')
100 100
      */
101
-    public function di1()
102
-    {
103
-    }
101
+public function di1()
102
+{
103
+}
104 104
 
105
-    /**
105
+/**
106 106
      * @di('attr' => 'colorService', 'class' => 'ColorService')
107 107
      * @di('attr' => 'textService', 'class' => '\Jaxon\Annotations\Tests\Service\TextService')
108 108
      */
109
-    public function di2()
110
-    {
111
-    }
109
+public function di2()
110
+{
111
+}
112 112
 
113
-    /**
113
+/**
114 114
      * @before('name' => 'funcBefore', 'with' => ['param1'])
115 115
      */
116
-    public function cbBeforeNoCall()
117
-    {
118
-    }
116
+public function cbBeforeNoCall()
117
+{
118
+}
119 119
 
120
-    /**
120
+/**
121 121
      * @before('call' => 'funcBefore', 'params' => ['param1'])
122 122
      */
123
-    public function cbBeforeUnknownAttr()
124
-    {
125
-    }
123
+public function cbBeforeUnknownAttr()
124
+{
125
+}
126 126
 
127
-    /**
127
+/**
128 128
      * @before('call' => 'funcBefore', 'with' => 'param1')
129 129
      */
130
-    public function cbBeforeWrongAttrType()
131
-    {
132
-    }
130
+public function cbBeforeWrongAttrType()
131
+{
132
+}
133 133
 
134
-    /**
134
+/**
135 135
      * @after('name' => 'funcAfter', 'with' => ['param1'])
136 136
      */
137
-    public function cbAfterNoCall()
138
-    {
139
-    }
137
+public function cbAfterNoCall()
138
+{
139
+}
140 140
 
141
-    /**
141
+/**
142 142
      * @after('call' => 'funcAfter', 'params' => ['param1'])
143 143
      */
144
-    public function cbAfterUnknownAttr()
145
-    {
146
-    }
144
+public function cbAfterUnknownAttr()
145
+{
146
+}
147 147
 
148
-    /**
148
+/**
149 149
      * @after('call' => 'funcAfter', 'with' => true)
150 150
      */
151
-    public function cbAfterWrongAttrType()
152
-    {
153
-    }
151
+public function cbAfterWrongAttrType()
152
+{
153
+}
154 154
 
155
-    /**
155
+/**
156 156
      * @di('attr' => 'attr', 'params' => '')
157 157
      */
158
-    public function diUnknownAttr()
159
-    {
160
-    }
158
+public function diUnknownAttr()
159
+{
160
+}
161 161
 
162
-    /**
162
+/**
163 163
      * @di('attr' => [], 'class' => 'ClassName')
164 164
      */
165
-    public function diWrongAttrType()
166
-    {
167
-    }
165
+public function diWrongAttrType()
166
+{
167
+}
168 168
 
169
-    /**
169
+/**
170 170
      * @di('attr' => 'attr', 'class' => true)
171 171
      */
172
-    public function diWrongClassType()
173
-    {
174
-    }
172
+public function diWrongClassType()
173
+{
174
+}
175 175
 
176
-    /**
176
+/**
177 177
      * @di('attr' => 'attr', 'class' => 'ClassName', 'name' => 'di')
178 178
      */
179
-    public function diWrongVarCount()
180
-    {
181
-    }
179
+public function diWrongVarCount()
180
+{
181
+}
182 182
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/TraitAnnotated.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,5 +20,5 @@
 block discarded – undo
20 20
  */
21 21
 class TraitAnnotated extends FuncComponent
22 22
 {
23
-    use Traits\Annotated;
23
+use Traits\Annotated;
24 24
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/DocBlockAnnotated.php 1 patch
Switch Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -8,197 +8,197 @@
 block discarded – undo
8 8
 
9 9
 class DocBlockAnnotated extends FuncComponent
10 10
 {
11
-    /**
11
+/**
12 12
      * @exclude true
13 13
      */
14
-    public function doNot()
15
-    {
16
-    }
14
+public function doNot()
15
+{
16
+}
17 17
 
18
-    /**
18
+/**
19 19
      * @exclude Me
20 20
      */
21
-    public function doNotError()
22
-    {
23
-    }
21
+public function doNotError()
22
+{
23
+}
24 24
 
25
-    /**
25
+/**
26 26
      * @databag user.name
27 27
      * @databag page.number
28 28
      */
29
-    public function withBags()
30
-    {
31
-    }
29
+public function withBags()
30
+{
31
+}
32 32
 
33
-    /**
33
+/**
34 34
      * @databag user:name
35 35
      */
36
-    public function withBagsErrorName()
37
-    {
38
-    }
36
+public function withBagsErrorName()
37
+{
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @databag page number
42 42
      */
43
-    public function withBagsErrorNumber()
44
-    {
45
-    }
43
+public function withBagsErrorNumber()
44
+{
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @upload user-files
49 49
      * @exclude false
50 50
      */
51
-    public function saveFiles()
52
-    {
53
-    }
51
+public function saveFiles()
52
+{
53
+}
54 54
 
55
-    /**
55
+/**
56 56
      * @upload user:file
57 57
      */
58
-    public function saveFileErrorFieldName()
59
-    {
60
-    }
58
+public function saveFileErrorFieldName()
59
+{
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * @upload user file
64 64
      */
65
-    public function saveFileErrorFieldNumber()
66
-    {
67
-    }
65
+public function saveFileErrorFieldNumber()
66
+{
67
+}
68 68
 
69
-    /**
69
+/**
70 70
      * @upload user-files
71 71
      */
72
-    public function saveFilesWrongName()
73
-    {
74
-    }
72
+public function saveFilesWrongName()
73
+{
74
+}
75 75
 
76
-    /**
76
+/**
77 77
      * @upload user-file1
78 78
      * @upload user-file2
79 79
      */
80
-    public function saveFilesMultiple()
81
-    {
82
-    }
80
+public function saveFilesMultiple()
81
+{
82
+}
83 83
 
84
-    /**
84
+/**
85 85
      * @before funcBefore
86 86
      * @after funcAfter
87 87
      */
88
-    public function cbSingle()
89
-    {
90
-    }
88
+public function cbSingle()
89
+{
90
+}
91 91
 
92
-    /**
92
+/**
93 93
      * @before funcBefore1
94 94
      * @before funcBefore2
95 95
      * @after funcAfter1
96 96
      * @after funcAfter2
97 97
      * @after funcAfter3
98 98
      */
99
-    public function cbMultiple()
100
-    {
101
-    }
99
+public function cbMultiple()
100
+{
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * @before funcBefore1 ["param1"]
105 105
      * @before funcBefore2 ["param1", "param2"]
106 106
      * @after funcAfter1 ["param1", "param2"]
107 107
      */
108
-    public function cbParams()
109
-    {
110
-    }
108
+public function cbParams()
109
+{
110
+}
111 111
 
112
-    /**
112
+/**
113 113
      * @before func:Before
114 114
      */
115
-    public function cbBeforeErrorName()
116
-    {
117
-    }
115
+public function cbBeforeErrorName()
116
+{
117
+}
118 118
 
119
-    /**
119
+/**
120 120
      * @before funcBefore false
121 121
      */
122
-    public function cbBeforeErrorParam()
123
-    {
124
-    }
122
+public function cbBeforeErrorParam()
123
+{
124
+}
125 125
 
126
-    /**
126
+/**
127 127
      * @before funcBefore ["param1"] false
128 128
      */
129
-    public function cbBeforeErrorNumber()
130
-    {
131
-    }
129
+public function cbBeforeErrorNumber()
130
+{
131
+}
132 132
 
133
-    /**
133
+/**
134 134
      * @before func:After
135 135
      */
136
-    public function cbAfterErrorName()
137
-    {
138
-    }
136
+public function cbAfterErrorName()
137
+{
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * @before funcAfter false
142 142
      */
143
-    public function cbAfterErrorParam()
144
-    {
145
-    }
143
+public function cbAfterErrorParam()
144
+{
145
+}
146 146
 
147
-    /**
147
+/**
148 148
      * @before funcAfter ["param1"] false
149 149
      */
150
-    public function cbAfterErrorNumber()
151
-    {
152
-    }
150
+public function cbAfterErrorNumber()
151
+{
152
+}
153 153
 
154
-    /**
154
+/**
155 155
      * @di $colorService ColorService
156 156
      * @di $fontService FontService
157 157
      */
158
-    public function di1()
159
-    {
160
-    }
158
+public function di1()
159
+{
160
+}
161 161
 
162
-    /**
162
+/**
163 163
      * @di $colorService ColorService
164 164
      * @di $textService \Jaxon\Annotations\Tests\Service\TextService
165 165
      */
166
-    public function di2()
167
-    {
168
-    }
166
+public function di2()
167
+{
168
+}
169 169
 
170
-    /**
170
+/**
171 171
      * @di $color.Service ColorService
172 172
      */
173
-    public function diErrorAttr()
174
-    {
175
-    }
173
+public function diErrorAttr()
174
+{
175
+}
176 176
 
177
-    /**
177
+/**
178 178
      * @di $colorService Color.Service
179 179
      */
180
-    public function diErrorClass()
181
-    {
182
-    }
180
+public function diErrorClass()
181
+{
182
+}
183 183
 
184
-    /**
184
+/**
185 185
      * @di $colorService
186 186
      */
187
-    public function diErrorOneParam()
188
-    {
189
-    }
187
+public function diErrorOneParam()
188
+{
189
+}
190 190
 
191
-    /**
191
+/**
192 192
      * @di $colorService ColorService TextService
193 193
      */
194
-    public function diErrorThreeParams()
195
-    {
196
-    }
194
+public function diErrorThreeParams()
195
+{
196
+}
197 197
 
198
-    /**
198
+/**
199 199
      * @callback jaxon.ajax.callback.test
200 200
      */
201
-    public function withCallback()
202
-    {
203
-    }
201
+public function withCallback()
202
+{
203
+}
204 204
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/AttrAnnotated.php 1 patch
Switch Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -7,130 +7,130 @@
 block discarded – undo
7 7
 
8 8
 class AttrAnnotated extends FuncComponent
9 9
 {
10
-    /**
10
+/**
11 11
      * @var ColorService
12 12
      */
13
-    protected $colorService;
13
+protected $colorService;
14 14
 
15
-    /**
15
+/**
16 16
      * @var FontService
17 17
      */
18
-    protected $fontService;
18
+protected $fontService;
19 19
 
20
-    /**
20
+/**
21 21
      * @var \Jaxon\Annotations\Tests\Service\TextService
22 22
      */
23
-    protected $textService;
23
+protected $textService;
24 24
 
25
-    /**
25
+/**
26 26
      * @di ColorService
27 27
      */
28
-    protected $colorService1;
28
+protected $colorService1;
29 29
 
30
-    /**
30
+/**
31 31
      * @di FontService
32 32
      */
33
-    protected $fontService1;
33
+protected $fontService1;
34 34
 
35
-    /**
35
+/**
36 36
      * @di \Jaxon\Annotations\Tests\Service\TextService
37 37
      */
38
-    protected $textService1;
38
+protected $textService1;
39 39
 
40
-    /**
40
+/**
41 41
      * @di
42 42
      * @var ColorService
43 43
      */
44
-    protected $colorService2;
44
+protected $colorService2;
45 45
 
46
-    /**
46
+/**
47 47
      * @di
48 48
      * @var FontService
49 49
      */
50
-    protected $fontService2;
50
+protected $fontService2;
51 51
 
52
-    /**
52
+/**
53 53
      * @di
54 54
      * @var \Jaxon\Annotations\Tests\Service\TextService
55 55
      */
56
-    protected $textService2;
56
+protected $textService2;
57 57
 
58
-    /**
58
+/**
59 59
      * @di('class' => 'ColorService')
60 60
      */
61
-    protected $colorService3;
61
+protected $colorService3;
62 62
 
63
-    /**
63
+/**
64 64
      * @di('class' => 'FontService')
65 65
      */
66
-    protected $fontService3;
66
+protected $fontService3;
67 67
 
68
-    /**
68
+/**
69 69
      * @di('class' => '\Jaxon\Annotations\Tests\Service\TextService')
70 70
      */
71
-    protected $textService3;
71
+protected $textService3;
72 72
 
73
-    /**
73
+/**
74 74
      * @di $fontService FontService
75 75
      */
76
-    protected $errorTwoParams;
76
+protected $errorTwoParams;
77 77
 
78
-    /**
78
+/**
79 79
      * @di('attr' => 'fontService')
80 80
      */
81
-    protected $errorDiAttr;
81
+protected $errorDiAttr;
82 82
 
83
-    /**
83
+/**
84 84
      * @di $fontService
85 85
      */
86
-    protected $errorDiDbAttr;
86
+protected $errorDiDbAttr;
87 87
 
88
-    /**
88
+/**
89 89
      * @di
90 90
      * @di FontService
91 91
      */
92
-    protected $errorTwoDi;
92
+protected $errorTwoDi;
93 93
 
94
-    /**
94
+/**
95 95
      * @di('attr' => 'colorService')
96 96
      * @di('attr' => 'fontService')
97 97
      * @di('attr' => 'textService')
98 98
      */
99
-    public function attrVar()
100
-    {
101
-    }
99
+public function attrVar()
100
+{
101
+}
102 102
 
103
-    /**
103
+/**
104 104
      * @di $colorService
105 105
      * @di $fontService
106 106
      * @di $textService
107 107
      */
108
-    public function attrDbVar()
109
-    {
110
-    }
108
+public function attrDbVar()
109
+{
110
+}
111 111
 
112
-    public function attrDi()
113
-    {
114
-    }
112
+public function attrDi()
113
+{
114
+}
115 115
 
116
-    /**
116
+/**
117 117
      * @di ColorService
118 118
      */
119
-    public function errorDiClass()
120
-    {
121
-    }
119
+public function errorDiClass()
120
+{
121
+}
122 122
 
123
-    /**
123
+/**
124 124
      * @di colorService ColorService
125 125
      */
126
-    public function errorDiNoVar()
127
-    {
128
-    }
126
+public function errorDiNoVar()
127
+{
128
+}
129 129
 
130
-    /**
130
+/**
131 131
      * @di $colorService $ColorService
132 132
      */
133
-    public function errorDiTwoVars()
134
-    {
135
-    }
133
+public function errorDiTwoVars()
134
+{
135
+}
136 136
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/AnnotationTrait.php 1 patch
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 trait AnnotationTrait
14 14
 {
15
-    /**
15
+/**
16 16
      * Get the metadata from a given class
17 17
      *
18 18
      * @param ReflectionClass|string $xClass
@@ -21,28 +21,28 @@  discard block
 block discarded – undo
21 21
      *
22 22
      * @return Metadata|null
23 23
      */
24
-    public function getAttributes(ReflectionClass|string $xClass,
25
-        array $aMethods = [], array $aProperties = []): ?Metadata
26
-    {
27
-        $xInputData = new InputData($xClass, $aMethods, $aProperties);
28
-        $xMetadataReader = jaxon()->di()->getMetadataReader('annotations');
29
-        return $xMetadataReader->getAttributes($xInputData);
30
-    }
24
+public function getAttributes(ReflectionClass|string $xClass,
25
+array $aMethods = [], array $aProperties = []): ?Metadata
26
+{
27
+$xInputData = new InputData($xClass, $aMethods, $aProperties);
28
+$xMetadataReader = jaxon()->di()->getMetadataReader('annotations');
29
+return $xMetadataReader->getAttributes($xInputData);
30
+}
31 31
 
32
-    /**
32
+/**
33 33
      * @param ReflectionClass $xClass
34 34
      *
35 35
      * @return ComponentOptions
36 36
      */
37
-    public function getOptions(ReflectionClass $xClass): ComponentOptions
38
-    {
39
-        $xConfigSetter = new ConfigSetter();
40
-        $aOptions = [
41
-            'separator' => '.',
42
-            'protected' => [],
43
-            'functions' => [],
44
-            'config' => $xConfigSetter->newConfig(['metadata' => ['format' => 'annotations']]),
45
-        ];
46
-        return jaxon()->cdi()->getComponentOptions($xClass, $aOptions);
47
-    }
37
+public function getOptions(ReflectionClass $xClass): ComponentOptions
38
+{
39
+$xConfigSetter = new ConfigSetter();
40
+$aOptions = [
41
+'separator' => '.',
42
+'protected' => [],
43
+'functions' => [],
44
+'config' => $xConfigSetter->newConfig(['metadata' => ['format' => 'annotations']]),
45
+];
46
+return jaxon()->cdi()->getComponentOptions($xClass, $aOptions);
47
+}
48 48
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/Component/DocBlockNodeBaseComponent.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
  */
11 11
 class DocBlockNodeBaseComponent extends BaseComponent
12 12
 {
13
-    use Traits\NodeTrait;
13
+use Traits\NodeTrait;
14 14
 }
Please login to merge, or discard this patch.
jaxon-annotations/tests/Attr/Ajax/Component/ExportErrorComponent.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,5 +10,5 @@
 block discarded – undo
10 10
  */
11 11
 class ExportErrorComponent extends BaseComponent
12 12
 {
13
-    use Traits\NodeTrait;
13
+use Traits\NodeTrait;
14 14
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/ComponentTrait.php 2 patches
Switch Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -241,83 +241,83 @@
 block discarded – undo
241 241
                 $this->aComponentPublicMethods['node'],
242 242
             $xReflectionClass->isSubclassOf(FuncComponent::class) =>
243 243
                 $this->aComponentPublicMethods['func'],
244
-            default => [[], []],
245
-        };
244
+default => [[], []],
245
+};
246 246
 
247
-        return [$aMethods, ...$aBaseMethods];
248
-    }
247
+return [$aMethods, ...$aBaseMethods];
248
+}
249 249
 
250
-    /**
250
+/**
251 251
      * @param ReflectionClass $xReflectionClass
252 252
      * @param array $aMethods
253 253
      * @param array $aOptions
254 254
      *
255 255
      * @return Metadata|null
256 256
      */
257
-    private function getComponentMetadata(ReflectionClass $xReflectionClass,
258
-        array $aMethods, array $aOptions): Metadata|null
259
-    {
260
-        /** @var Config|null */
261
-        $xPackageConfig = $aOptions['config'] ?? null;
262
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263
-        {
264
-            return null;
265
-        }
266
-        $sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
-        if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
268
-        {
269
-            return null;
270
-        }
257
+private function getComponentMetadata(ReflectionClass $xReflectionClass,
258
+array $aMethods, array $aOptions): Metadata|null
259
+{
260
+/** @var Config|null */
261
+$xPackageConfig = $aOptions['config'] ?? null;
262
+if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263
+{
264
+return null;
265
+}
266
+$sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
+if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
268
+{
269
+return null;
270
+}
271 271
 
272
-        // Try to get the class metadata from the cache.
273
-        $di = $this->cn();
274
-        $xMetadata = null;
275
-        $xMetadataCache = null;
276
-        $xConfig = $di->config();
277
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
278
-        {
279
-            if(!$di->h('jaxon_metadata_cache_dir'))
280
-            {
281
-                $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282
-                $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283
-            }
284
-            $xMetadataCache = $di->getMetadataCache();
285
-            $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
-            if($xMetadata !== null)
287
-            {
288
-                return $xMetadata;
289
-            }
290
-        }
272
+// Try to get the class metadata from the cache.
273
+$di = $this->cn();
274
+$xMetadata = null;
275
+$xMetadataCache = null;
276
+$xConfig = $di->config();
277
+if($xConfig->getAppOption('metadata.cache.enabled', false))
278
+{
279
+if(!$di->h('jaxon_metadata_cache_dir'))
280
+{
281
+    $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282
+    $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283
+}
284
+$xMetadataCache = $di->getMetadataCache();
285
+$xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
+if($xMetadata !== null)
287
+{
288
+    return $xMetadata;
289
+}
290
+}
291 291
 
292
-        $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
294
-                ReflectionProperty::IS_PROTECTED));
292
+$aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
+$xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
294
+    ReflectionProperty::IS_PROTECTED));
295 295
 
296
-        $xMetadataReader = $di->getMetadataReader($sMetadataFormat);
297
-        $xInput = new InputData($xReflectionClass, $aMethods, $aProperties);
298
-        $xMetadata = $xMetadataReader->getAttributes($xInput);
296
+$xMetadataReader = $di->getMetadataReader($sMetadataFormat);
297
+$xInput = new InputData($xReflectionClass, $aMethods, $aProperties);
298
+$xMetadata = $xMetadataReader->getAttributes($xInput);
299 299
 
300
-        // Try to save the metadata in the cache
301
-        if($xMetadataCache !== null)
302
-        {
303
-            $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304
-        }
300
+// Try to save the metadata in the cache
301
+if($xMetadataCache !== null)
302
+{
303
+$xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304
+}
305 305
 
306
-        return $xMetadata;
307
-    }
306
+return $xMetadata;
307
+}
308 308
 
309
-    /**
309
+/**
310 310
      * @param ReflectionClass $xReflectionClass
311 311
      * @param array $aOptions
312 312
      *
313 313
      * @return ComponentOptions
314 314
      */
315
-    public function getComponentOptions(ReflectionClass $xReflectionClass,
316
-        array $aOptions): ComponentOptions
317
-    {
318
-        $aMethods = $this->getPublicMethods($xReflectionClass);
319
-        $xMetadata = $this->getComponentMetadata($xReflectionClass, $aMethods[0], $aOptions);
315
+public function getComponentOptions(ReflectionClass $xReflectionClass,
316
+array $aOptions): ComponentOptions
317
+{
318
+$aMethods = $this->getPublicMethods($xReflectionClass);
319
+$xMetadata = $this->getComponentMetadata($xReflectionClass, $aMethods[0], $aOptions);
320 320
 
321
-        return new ComponentOptions($aMethods, $aOptions, $xMetadata);
322
-    }
321
+return new ComponentOptions($aMethods, $aOptions, $xMetadata);
322
+}
323 323
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
         $xRegistry->updateHash(false); // Disable hash calculation.
152 152
 
153 153
         $sComponentId = str_replace('\\', '.', $sClassName);
154
-        if(!isset($this->aComponents[$sComponentId]))
154
+        if (!isset($this->aComponents[$sComponentId]))
155 155
         {
156 156
             $aOptions = $xRegistry->getNamespaceComponentOptions($sClassName);
157
-            if($aOptions !== null)
157
+            if ($aOptions !== null)
158 158
             {
159 159
                 $this->saveComponent($sClassName, $aOptions);
160 160
             }
161 161
         }
162
-        if(isset($this->aComponents[$sComponentId]))
162
+        if (isset($this->aComponents[$sComponentId]))
163 163
         {
164 164
             return; // The component is found.
165 165
         }
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
         // The component was not found in a registered namespace. We need to parse all
168 168
         // the directories to be able to find a component registered without a namespace.
169 169
         $sComponentId = str_replace('\\', '_', $sClassName);
170
-        if(!isset($this->aComponents[$sComponentId]))
170
+        if (!isset($this->aComponents[$sComponentId]))
171 171
         {
172 172
             $xRegistry->registerComponentsInDirectories();
173 173
         }
174
-        if(isset($this->aComponents[$sComponentId]))
174
+        if (isset($this->aComponents[$sComponentId]))
175 175
         {
176 176
             return; // The component is found.
177 177
         }
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     public function getCallableObjects(): array
190 190
     {
191 191
         $aCallableObjects = [];
192
-        foreach($this->aComponents as $sComponentId => $_)
192
+        foreach ($this->aComponents as $sComponentId => $_)
193 193
         {
194 194
             $aCallableObjects[$sComponentId] = $this->makeCallableObject($sComponentId);
195 195
         }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     private function setComponentPublicMethods(string $sKey, string $sClass,
207 207
         array $aNeverExported): void
208 208
     {
209
-        if(isset($this->aComponentPublicMethods[$sKey]))
209
+        if (isset($this->aComponentPublicMethods[$sKey]))
210 210
         {
211 211
             return;
212 212
         }
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
     {
260 260
         /** @var Config|null */
261 261
         $xPackageConfig = $aOptions['config'] ?? null;
262
-        if($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
262
+        if ($xPackageConfig === null || (bool)($aOptions['excluded'] ?? false))
263 263
         {
264 264
             return null;
265 265
         }
266 266
         $sMetadataFormat = $xPackageConfig->getOption('metadata.format');
267
-        if(!in_array($sMetadataFormat, ['attributes', 'annotations']))
267
+        if (!in_array($sMetadataFormat, ['attributes', 'annotations']))
268 268
         {
269 269
             return null;
270 270
         }
@@ -274,23 +274,23 @@  discard block
 block discarded – undo
274 274
         $xMetadata = null;
275 275
         $xMetadataCache = null;
276 276
         $xConfig = $di->config();
277
-        if($xConfig->getAppOption('metadata.cache.enabled', false))
277
+        if ($xConfig->getAppOption('metadata.cache.enabled', false))
278 278
         {
279
-            if(!$di->h('jaxon_metadata_cache_dir'))
279
+            if (!$di->h('jaxon_metadata_cache_dir'))
280 280
             {
281 281
                 $sCacheDir = $xConfig->getAppOption('metadata.cache.dir');
282 282
                 $di->val('jaxon_metadata_cache_dir', $sCacheDir);
283 283
             }
284 284
             $xMetadataCache = $di->getMetadataCache();
285 285
             $xMetadata = $xMetadataCache->read($xReflectionClass->getName());
286
-            if($xMetadata !== null)
286
+            if ($xMetadata !== null)
287 287
             {
288 288
                 return $xMetadata;
289 289
             }
290 290
         }
291 291
 
292 292
         $aProperties = array_map(fn($xProperty) => $xProperty->getName(),
293
-            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC |
293
+            $xReflectionClass->getProperties(ReflectionProperty::IS_PUBLIC|
294 294
                 ReflectionProperty::IS_PROTECTED));
295 295
 
296 296
         $xMetadataReader = $di->getMetadataReader($sMetadataFormat);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         $xMetadata = $xMetadataReader->getAttributes($xInput);
299 299
 
300 300
         // Try to save the metadata in the cache
301
-        if($xMetadataCache !== null)
301
+        if ($xMetadataCache !== null)
302 302
         {
303 303
             $xMetadataCache->save($xReflectionClass->getName(), $xMetadata);
304 304
         }
Please login to merge, or discard this patch.