Passed
Push — main ( 27211a...7f530d )
by Thierry
03:53
created
jaxon-core/src/App/Metadata/Data/ExportData.php 1 patch
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,53 +22,53 @@
 block discarded – undo
22 22
 
23 23
 class ExportData extends AbstractData
24 24
 {
25
-    /**
25
+/**
26 26
      * @var array<string, array<string>>
27 27
      */
28
-    private array $aMethods = [];
28
+private array $aMethods = [];
29 29
 
30
-    /**
30
+/**
31 31
      * @return string
32 32
      */
33
-    public function getName(): string
34
-    {
35
-        return 'export';
36
-    }
33
+public function getName(): string
34
+{
35
+return 'export';
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * @return mixed
40 40
      */
41
-    public function getValue(): mixed
42
-    {
43
-        return $this->aMethods;
44
-    }
41
+public function getValue(): mixed
42
+{
43
+return $this->aMethods;
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * @param array $aMethods
48 48
      *
49 49
      * @return void
50 50
      */
51
-    public function setMethods(array $aMethods): void
51
+public function setMethods(array $aMethods): void
52
+{
53
+foreach(['base', 'only', 'except'] as $sKey)
54
+{
55
+foreach($aMethods[$sKey] ?? [] as $sMethod)
56
+{
57
+    if(!is_string($sMethod) || !$this->validateMethod($sMethod))
52 58
     {
53
-        foreach(['base', 'only', 'except'] as $sKey)
54
-        {
55
-            foreach($aMethods[$sKey] ?? [] as $sMethod)
56
-            {
57
-                if(!is_string($sMethod) || !$this->validateMethod($sMethod))
58
-                {
59
-                    throw new SetupException("'$sMethod' is not a valid method name.");
60
-                }
61
-            }
62
-        }
63
-        $this->aMethods = $aMethods;
59
+        throw new SetupException("'$sMethod' is not a valid method name.");
64 60
     }
61
+}
62
+}
63
+$this->aMethods = $aMethods;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * @inheritDoc
68 68
      */
69
-    public function encode(string $sVarName): array
70
-    {
71
-        $sMethods = addslashes(json_encode($this->aMethods));
72
-        return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
-    }
69
+public function encode(string $sVarName): array
70
+{
71
+$sMethods = addslashes(json_encode($this->aMethods));
72
+return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
+}
74 74
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/ComponentOptions.php 1 patch
Switch Indentation   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -34,221 +34,221 @@  discard block
 block discarded – undo
34 34
 
35 35
 class ComponentOptions
36 36
 {
37
-    /**
37
+/**
38 38
      * Check if the js code for this object must be generated
39 39
      *
40 40
      * @var bool
41 41
      */
42
-    private $bExcluded = false;
42
+private $bExcluded = false;
43 43
 
44
-    /**
44
+/**
45 45
      * The character to use as separator in javascript class names
46 46
      *
47 47
      * @var string
48 48
      */
49
-    private $sSeparator = '.';
49
+private $sSeparator = '.';
50 50
 
51
-    /**
51
+/**
52 52
      * A list of methods of the user registered callable object the library can export to javascript
53 53
      *
54 54
      * @var array
55 55
      */
56
-    private $aPublicMethods = [];
56
+private $aPublicMethods = [];
57 57
 
58
-    /**
58
+/**
59 59
      * The methods in the export attributes
60 60
      *
61 61
      * @var array
62 62
      */
63
-    private $aExportMethods = ['except' => []];
63
+private $aExportMethods = ['except' => []];
64 64
 
65
-    /**
65
+/**
66 66
      * A list of methods to call before processing the request
67 67
      *
68 68
      * @var array
69 69
      */
70
-    private $aBeforeMethods = [];
70
+private $aBeforeMethods = [];
71 71
 
72
-    /**
72
+/**
73 73
      * A list of methods to call after processing the request
74 74
      *
75 75
      * @var array
76 76
      */
77
-    private $aAfterMethods = [];
77
+private $aAfterMethods = [];
78 78
 
79
-    /**
79
+/**
80 80
      * The javascript class options
81 81
      *
82 82
      * @var array
83 83
      */
84
-    private $aJsOptions = [];
84
+private $aJsOptions = [];
85 85
 
86
-    /**
86
+/**
87 87
      * The DI options
88 88
      *
89 89
      * @var array
90 90
      */
91
-    private $aDiOptions = [];
91
+private $aDiOptions = [];
92 92
 
93
-    /**
93
+/**
94 94
      * The constructor
95 95
      *
96 96
      * @param array $aMethods
97 97
      * @param array $aOptions
98 98
      * @param Metadata|null $xMetadata
99 99
      */
100
-    public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
-    {
102
-        $this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
-            (bool)($aOptions['excluded'] ?? false);
104
-        if($this->bExcluded)
105
-        {
106
-            return;
107
-        }
100
+public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
+{
102
+$this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
+(bool)($aOptions['excluded'] ?? false);
104
+if($this->bExcluded)
105
+{
106
+return;
107
+}
108 108
 
109
-        // Options from the config.
110
-        $sSeparator = $aOptions['separator'];
111
-        $this->sSeparator = $sSeparator === '_' ? $sSeparator : '.';
109
+// Options from the config.
110
+$sSeparator = $aOptions['separator'];
111
+$this->sSeparator = $sSeparator === '_' ? $sSeparator : '.';
112 112
 
113
-        $this->addProtectedMethods($aOptions['protected']);
113
+$this->addProtectedMethods($aOptions['protected']);
114 114
 
115
-        foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
116
-        {
117
-            // Names are in a comma-separated list.
118
-            $aFunctionNames = explode(',', $sNames);
119
-            foreach($aFunctionNames as $sFunctionName)
120
-            {
121
-                $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
122
-            }
123
-        }
115
+foreach($aOptions['functions'] as $sNames => $aFunctionOptions)
116
+{
117
+// Names are in a comma-separated list.
118
+$aFunctionNames = explode(',', $sNames);
119
+foreach($aFunctionNames as $sFunctionName)
120
+{
121
+    $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
122
+}
123
+}
124 124
 
125
-        // Options from the attributes or annotations.
126
-        if($xMetadata !== null)
127
-        {
128
-            // Excluded methods must be merged with the existing ones.
129
-            $aExportMethods = $xMetadata->getExportMethods();
130
-            $aExportMethods['except'] = array_unique(array_merge(
131
-                $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
132
-            $this->aExportMethods = $aExportMethods;
125
+// Options from the attributes or annotations.
126
+if($xMetadata !== null)
127
+{
128
+// Excluded methods must be merged with the existing ones.
129
+$aExportMethods = $xMetadata->getExportMethods();
130
+$aExportMethods['except'] = array_unique(array_merge(
131
+    $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
132
+$this->aExportMethods = $aExportMethods;
133 133
 
134
-            foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
135
-            {
136
-                $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
137
-            }
138
-        }
134
+foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
135
+{
136
+    $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
137
+}
138
+}
139 139
 
140
-        $this->aPublicMethods = $this->filterPublicMethods($aMethods);
141
-    }
140
+$this->aPublicMethods = $this->filterPublicMethods($aMethods);
141
+}
142 142
 
143
-    /**
143
+/**
144 144
      * @param array|string $xMethods
145 145
      *
146 146
      * @return void
147 147
      */
148
-    private function addProtectedMethods(array|string $xMethods): void
149
-    {
150
-        $this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
151
-            !is_array($xMethods) ? [trim((string)$xMethods)] :
152
-            array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
153
-    }
148
+private function addProtectedMethods(array|string $xMethods): void
149
+{
150
+$this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
151
+!is_array($xMethods) ? [trim((string)$xMethods)] :
152
+array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
153
+}
154 154
 
155
-    /**
155
+/**
156 156
      * @param array $aMethods
157 157
      *
158 158
      * @return array
159 159
      */
160
-    private function filterPublicMethods(array $aMethods): array
161
-    {
162
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
163
-        {
164
-            return [];
165
-        }
160
+private function filterPublicMethods(array $aMethods): array
161
+{
162
+if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
163
+{
164
+return [];
165
+}
166 166
 
167
-        $aBaseMethods = $aMethods[1];
168
-        $aNoMethods = $aMethods[2];
169
-        $aMethods = $aMethods[0];
170
-        if(isset($this->aExportMethods['only']))
171
-        {
172
-            $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
173
-        }
174
-        $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
175
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
176
-        {
177
-            $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
178
-        }
167
+$aBaseMethods = $aMethods[1];
168
+$aNoMethods = $aMethods[2];
169
+$aMethods = $aMethods[0];
170
+if(isset($this->aExportMethods['only']))
171
+{
172
+$aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
173
+}
174
+$aMethods = array_diff($aMethods, $this->aExportMethods['except']);
175
+if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
176
+{
177
+$aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
178
+}
179 179
 
180
-        return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
181
-    }
180
+return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
181
+}
182 182
 
183
-    /**
183
+/**
184 184
      * @return array
185 185
      */
186
-    public function getPublicMethods(): array
187
-    {
188
-        return $this->aPublicMethods;
189
-    }
186
+public function getPublicMethods(): array
187
+{
188
+return $this->aPublicMethods;
189
+}
190 190
 
191
-    /**
191
+/**
192 192
      * @param string $sMethodName
193 193
      *
194 194
      * @return bool
195 195
      */
196
-    public function isPublicMethod(string $sMethodName): bool
197
-    {
198
-        return in_array($sMethodName, $this->aPublicMethods);
199
-    }
196
+public function isPublicMethod(string $sMethodName): bool
197
+{
198
+return in_array($sMethodName, $this->aPublicMethods);
199
+}
200 200
 
201
-    /**
201
+/**
202 202
      * Check if the js code for this object must be generated
203 203
      *
204 204
      * @return bool
205 205
      */
206
-    public function excluded(): bool
207
-    {
208
-        return $this->bExcluded;
209
-    }
206
+public function excluded(): bool
207
+{
208
+return $this->bExcluded;
209
+}
210 210
 
211
-    /**
211
+/**
212 212
      * @return string
213 213
      */
214
-    public function separator(): string
215
-    {
216
-        return $this->sSeparator;
217
-    }
214
+public function separator(): string
215
+{
216
+return $this->sSeparator;
217
+}
218 218
 
219
-    /**
219
+/**
220 220
      * @return array
221 221
      */
222
-    public function beforeMethods(): array
223
-    {
224
-        return $this->aBeforeMethods;
225
-    }
222
+public function beforeMethods(): array
223
+{
224
+return $this->aBeforeMethods;
225
+}
226 226
 
227
-    /**
227
+/**
228 228
      * @return array
229 229
      */
230
-    public function afterMethods(): array
231
-    {
232
-        return $this->aAfterMethods;
233
-    }
230
+public function afterMethods(): array
231
+{
232
+return $this->aAfterMethods;
233
+}
234 234
 
235
-    /**
235
+/**
236 236
      * @return array
237 237
      */
238
-    public function diOptions(): array
239
-    {
240
-        return $this->aDiOptions;
241
-    }
238
+public function diOptions(): array
239
+{
240
+return $this->aDiOptions;
241
+}
242 242
 
243
-    /**
243
+/**
244 244
      * @return array
245 245
      */
246
-    public function jsOptions(): array
247
-    {
248
-        return $this->aJsOptions;
249
-    }
246
+public function jsOptions(): array
247
+{
248
+return $this->aJsOptions;
249
+}
250 250
 
251
-    /**
251
+/**
252 252
      * Set hook methods
253 253
      *
254 254
      * @param array $aHookMethods    The array of hook methods
@@ -256,34 +256,34 @@  discard block
 block discarded – undo
256 256
      *
257 257
      * @return void
258 258
      */
259
-    private function setHookMethods(array &$aHookMethods, $xValue): void
260
-    {
261
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
262
-        {
263
-            if(!isset($aHookMethods[$sCalledMethod]))
264
-            {
265
-                $aHookMethods[$sCalledMethod] = [];
266
-            }
267
-            if(is_array($xMethodToCall))
268
-            {
269
-                $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
270
-            }
271
-            elseif(is_string($xMethodToCall))
272
-            {
273
-                $aHookMethods[$sCalledMethod][] = $xMethodToCall;
274
-            }
275
-        }
276
-    }
259
+private function setHookMethods(array &$aHookMethods, $xValue): void
260
+{
261
+foreach($xValue as $sCalledMethod => $xMethodToCall)
262
+{
263
+if(!isset($aHookMethods[$sCalledMethod]))
264
+{
265
+    $aHookMethods[$sCalledMethod] = [];
266
+}
267
+if(is_array($xMethodToCall))
268
+{
269
+    $aHookMethods[$sCalledMethod] = array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
270
+}
271
+elseif(is_string($xMethodToCall))
272
+{
273
+    $aHookMethods[$sCalledMethod][] = $xMethodToCall;
274
+}
275
+}
276
+}
277 277
 
278
-    /**
278
+/**
279 279
      * @param array $aDiOptions
280 280
      */
281
-    private function addDiOption(array $aDiOptions): void
282
-    {
283
-        $this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
284
-    }
281
+private function addDiOption(array $aDiOptions): void
282
+{
283
+$this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
284
+}
285 285
 
286
-    /**
286
+/**
287 287
      * Set configuration options / call options for each method
288 288
      *
289 289
      * @param string $sName    The name of the configuration option
@@ -291,25 +291,25 @@  discard block
 block discarded – undo
291 291
      *
292 292
      * @return void
293 293
      */
294
-    private function addOption(string $sName, $xValue): void
295
-    {
296
-        switch($sName)
297
-        {
298
-        // Set the methods to call before processing the request
299
-        case '__before':
300
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
301
-            break;
302
-        // Set the methods to call after processing the request
303
-        case '__after':
304
-            $this->setHookMethods($this->aAfterMethods, $xValue);
305
-            break;
306
-        // Set the attributes to inject in the callable object
307
-        case '__di':
308
-            $this->addDiOption($xValue);
309
-            break;
310
-        default:
311
-            break;
312
-        }
294
+private function addOption(string $sName, $xValue): void
295
+{
296
+switch($sName)
297
+{
298
+// Set the methods to call before processing the request
299
+case '__before':
300
+$this->setHookMethods($this->aBeforeMethods, $xValue);
301
+break;
302
+// Set the methods to call after processing the request
303
+case '__after':
304
+$this->setHookMethods($this->aAfterMethods, $xValue);
305
+break;
306
+// Set the attributes to inject in the callable object
307
+case '__di':
308
+$this->addDiOption($xValue);
309
+break;
310
+default:
311
+break;
312
+}
313 313
     }
314 314
 
315 315
     /**
Please login to merge, or discard this patch.
jaxon-annotations/src/AnnotationReader.php 1 patch
Switch Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -37,207 +37,207 @@
 block discarded – undo
37 37
 
38 38
 class AnnotationReader implements MetadataReaderInterface
39 39
 {
40
-    /**
40
+/**
41 41
      * @var AnnotationManager
42 42
      */
43
-    protected $xManager;
43
+protected $xManager;
44 44
 
45
-    /**
45
+/**
46 46
      * @var Metadata
47 47
      */
48
-    protected $xMetadata;
48
+protected $xMetadata;
49 49
 
50
-    /**
50
+/**
51 51
      * Properties types, read from the "var" annotations.
52 52
      *
53 53
      * @var array
54 54
      */
55
-    protected $aPropTypes;
55
+protected $aPropTypes;
56 56
 
57
-    /**
57
+/**
58 58
      * The type of the class member being currently processed.
59 59
      *
60 60
      * @var string
61 61
      */
62
-    protected $sCurrMemberType;
62
+protected $sCurrMemberType;
63 63
 
64
-    /**
64
+/**
65 65
      * The constructor
66 66
      *
67 67
      * @param AnnotationManager $xManager
68 68
      */
69
-    public function __construct(AnnotationManager $xManager)
70
-    {
71
-        $this->xManager = $xManager;
72
-        $this->xManager->registry['upload'] = UploadAnnotation::class;
73
-        $this->xManager->registry['databag'] = DatabagAnnotation::class;
74
-        $this->xManager->registry['exclude'] = ExcludeAnnotation::class;
75
-        $this->xManager->registry['export'] = ExportAnnotation::class;
76
-        $this->xManager->registry['before'] = BeforeAnnotation::class;
77
-        $this->xManager->registry['after'] = AfterAnnotation::class;
78
-        $this->xManager->registry['di'] = ContainerAnnotation::class;
79
-        $this->xManager->registry['callback'] = CallbackAnnotation::class;
80
-        // Missing standard annotations.
81
-        // We need to define this, otherwise they throw an exception, and make the whole processing fail.
82
-        $this->xManager->registry['const'] = false;
83
-        $this->xManager->registry['inheritDoc'] = false;
84
-        $this->xManager->registry['template'] = false;
85
-        $this->xManager->registry['param-closure-this'] = false;
86
-    }
69
+public function __construct(AnnotationManager $xManager)
70
+{
71
+$this->xManager = $xManager;
72
+$this->xManager->registry['upload'] = UploadAnnotation::class;
73
+$this->xManager->registry['databag'] = DatabagAnnotation::class;
74
+$this->xManager->registry['exclude'] = ExcludeAnnotation::class;
75
+$this->xManager->registry['export'] = ExportAnnotation::class;
76
+$this->xManager->registry['before'] = BeforeAnnotation::class;
77
+$this->xManager->registry['after'] = AfterAnnotation::class;
78
+$this->xManager->registry['di'] = ContainerAnnotation::class;
79
+$this->xManager->registry['callback'] = CallbackAnnotation::class;
80
+// Missing standard annotations.
81
+// We need to define this, otherwise they throw an exception, and make the whole processing fail.
82
+$this->xManager->registry['const'] = false;
83
+$this->xManager->registry['inheritDoc'] = false;
84
+$this->xManager->registry['template'] = false;
85
+$this->xManager->registry['param-closure-this'] = false;
86
+}
87 87
 
88
-    /**
88
+/**
89 89
      * @return array
90 90
      */
91
-    public function getPropTypes(): array
92
-    {
93
-        return $this->aPropTypes;
94
-    }
91
+public function getPropTypes(): array
92
+{
93
+return $this->aPropTypes;
94
+}
95 95
 
96
-    /**
96
+/**
97 97
      * @return bool
98 98
      */
99
-    public function annotationIsOnProperty(): bool
100
-    {
101
-        return $this->sCurrMemberType === AnnotationManager::MEMBER_PROPERTY;
102
-    }
99
+public function annotationIsOnProperty(): bool
100
+{
101
+return $this->sCurrMemberType === AnnotationManager::MEMBER_PROPERTY;
102
+}
103 103
 
104
-    /**
104
+/**
105 105
      * @param string $sClass
106 106
      *
107 107
      * @return void
108 108
      * @throws AnnotationException
109 109
      */
110
-    private function getClassAttrs(string $sClass): void
111
-    {
112
-        // Only keep the annotations declared in this package.
113
-        /** @var array<AbstractAnnotation> */
114
-        $aAnnotations = array_filter(
115
-            $this->xManager->getClassAnnotations($sClass),
116
-            fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
117
-        );
118
-        // First check if the class is excluded.
119
-        foreach($aAnnotations as $xAnnotation)
120
-        {
121
-            if(is_a($xAnnotation, ExcludeAnnotation::class))
122
-            {
123
-                $xAnnotation->saveValue($this->xMetadata);
124
-            }
125
-        }
126
-        if($this->xMetadata->isExcluded())
127
-        {
128
-            return;
129
-        }
130
-
131
-        foreach($aAnnotations as $xAnnotation)
132
-        {
133
-            if(!is_a($xAnnotation, ExcludeAnnotation::class))
134
-            {
135
-                $xAnnotation->saveValue($this->xMetadata);
136
-            }
137
-        }
138
-    }
110
+private function getClassAttrs(string $sClass): void
111
+{
112
+// Only keep the annotations declared in this package.
113
+/** @var array<AbstractAnnotation> */
114
+$aAnnotations = array_filter(
115
+$this->xManager->getClassAnnotations($sClass),
116
+fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
117
+);
118
+// First check if the class is excluded.
119
+foreach($aAnnotations as $xAnnotation)
120
+{
121
+if(is_a($xAnnotation, ExcludeAnnotation::class))
122
+{
123
+    $xAnnotation->saveValue($this->xMetadata);
124
+}
125
+}
126
+if($this->xMetadata->isExcluded())
127
+{
128
+return;
129
+}
139 130
 
140
-    /**
131
+foreach($aAnnotations as $xAnnotation)
132
+{
133
+if(!is_a($xAnnotation, ExcludeAnnotation::class))
134
+{
135
+    $xAnnotation->saveValue($this->xMetadata);
136
+}
137
+}
138
+}
139
+
140
+/**
141 141
      * @param string $sClass
142 142
      * @param string $sProperty
143 143
      *
144 144
      * @return void
145 145
      * @throws AnnotationException
146 146
      */
147
-    private function getPropertyAttrs(string $sClass, string $sProperty): void
147
+private function getPropertyAttrs(string $sClass, string $sProperty): void
148
+{
149
+/** @var array<ContainerAnnotation> */
150
+// Only keep the annotations declared in this package.
151
+$aAnnotations = array_filter(
152
+$this->xManager->getPropertyAnnotations($sClass, $sProperty),
153
+function($xAnnotation) use($sProperty) {
154
+    // Save the property type
155
+    if(is_a($xAnnotation, VarAnnotation::class))
148 156
     {
149
-        /** @var array<ContainerAnnotation> */
150
-        // Only keep the annotations declared in this package.
151
-        $aAnnotations = array_filter(
152
-            $this->xManager->getPropertyAnnotations($sClass, $sProperty),
153
-            function($xAnnotation) use($sProperty) {
154
-                // Save the property type
155
-                if(is_a($xAnnotation, VarAnnotation::class))
156
-                {
157
-                    $this->aPropTypes[$sProperty] = $xAnnotation->type;
158
-                }
159
-                // Only container annotations are allowed on properties
160
-                return is_a($xAnnotation, ContainerAnnotation::class);
161
-            }
162
-        );
163
-        if(count($aAnnotations) > 1)
164
-        {
165
-            throw new AnnotationException('Only one @di annotation is allowed on a property');
166
-        }
167
-
168
-        foreach($aAnnotations as $xAnnotation)
169
-        {
170
-            $xAnnotation->setAttr($sProperty);
171
-            $xAnnotation->saveValue($this->xMetadata);
172
-        }
157
+        $this->aPropTypes[$sProperty] = $xAnnotation->type;
173 158
     }
159
+    // Only container annotations are allowed on properties
160
+    return is_a($xAnnotation, ContainerAnnotation::class);
161
+}
162
+);
163
+if(count($aAnnotations) > 1)
164
+{
165
+throw new AnnotationException('Only one @di annotation is allowed on a property');
166
+}
174 167
 
175
-    /**
168
+foreach($aAnnotations as $xAnnotation)
169
+{
170
+$xAnnotation->setAttr($sProperty);
171
+$xAnnotation->saveValue($this->xMetadata);
172
+}
173
+}
174
+
175
+/**
176 176
      * @param string $sClass
177 177
      * @param string $sMethod
178 178
      *
179 179
      * @return void
180 180
      * @throws AnnotationException
181 181
      */
182
-    private function getMethodAttrs(string $sClass, string $sMethod): void
183
-    {
184
-        // Only keep the annotations declared in this package.
185
-        /** @var array<AbstractAnnotation> */
186
-        $aAnnotations = array_filter(
187
-            $this->xManager->getMethodAnnotations($sClass, $sMethod),
188
-            fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
189
-        );
190
-        foreach($aAnnotations as $xAnnotation)
191
-        {
192
-            $xAnnotation->saveValue($this->xMetadata, $sMethod);
193
-        }
194
-    }
182
+private function getMethodAttrs(string $sClass, string $sMethod): void
183
+{
184
+// Only keep the annotations declared in this package.
185
+/** @var array<AbstractAnnotation> */
186
+$aAnnotations = array_filter(
187
+$this->xManager->getMethodAnnotations($sClass, $sMethod),
188
+fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class)
189
+);
190
+foreach($aAnnotations as $xAnnotation)
191
+{
192
+$xAnnotation->saveValue($this->xMetadata, $sMethod);
193
+}
194
+}
195 195
 
196
-    /**
196
+/**
197 197
      * @inheritDoc
198 198
      * @throws SetupException
199 199
      */
200
-    public function getAttributes(InputData $xInput): Metadata
201
-    {
202
-        ContainerAnnotation::$xReader = $this;
203
-        $this->aPropTypes = [];
204
-        $this->xMetadata = new Metadata();
205
-        $sClass = $xInput->getReflectionClass()->getName();
206
-
207
-        try
208
-        {
209
-            // Processing class annotations
210
-            $this->sCurrMemberType = AnnotationManager::MEMBER_CLASS;
211
-
212
-            $this->getClassAttrs($sClass);
213
-            if($this->xMetadata->isExcluded())
214
-            {
215
-                // The entire class is not to be exported.
216
-                return $this->xMetadata;
217
-            }
218
-
219
-            // Processing properties annotations
220
-            $this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY;
221
-
222
-            // Properties annotations
223
-            foreach($xInput->getProperties() as $sProperty)
224
-            {
225
-                $this->getPropertyAttrs($sClass, $sProperty);
226
-            }
227
-
228
-            // Processing methods annotations
229
-            $this->sCurrMemberType = AnnotationManager::MEMBER_METHOD;
230
-
231
-            foreach($xInput->getMethods() as $sMethod)
232
-            {
233
-                $this->getMethodAttrs($sClass, $sMethod);
234
-            }
235
-
236
-            return $this->xMetadata;
237
-        }
238
-        catch(AnnotationException $e)
239
-        {
240
-            throw new SetupException($e->getMessage());
241
-        }
242
-    }
200
+public function getAttributes(InputData $xInput): Metadata
201
+{
202
+ContainerAnnotation::$xReader = $this;
203
+$this->aPropTypes = [];
204
+$this->xMetadata = new Metadata();
205
+$sClass = $xInput->getReflectionClass()->getName();
206
+
207
+try
208
+{
209
+// Processing class annotations
210
+$this->sCurrMemberType = AnnotationManager::MEMBER_CLASS;
211
+
212
+$this->getClassAttrs($sClass);
213
+if($this->xMetadata->isExcluded())
214
+{
215
+    // The entire class is not to be exported.
216
+    return $this->xMetadata;
217
+}
218
+
219
+// Processing properties annotations
220
+$this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY;
221
+
222
+// Properties annotations
223
+foreach($xInput->getProperties() as $sProperty)
224
+{
225
+    $this->getPropertyAttrs($sClass, $sProperty);
226
+}
227
+
228
+// Processing methods annotations
229
+$this->sCurrMemberType = AnnotationManager::MEMBER_METHOD;
230
+
231
+foreach($xInput->getMethods() as $sMethod)
232
+{
233
+    $this->getMethodAttrs($sClass, $sMethod);
234
+}
235
+
236
+return $this->xMetadata;
237
+}
238
+catch(AnnotationException $e)
239
+{
240
+throw new SetupException($e->getMessage());
241
+}
242
+}
243 243
 }
Please login to merge, or discard this patch.