Skip to content

Commit 3b4a667

Browse files
committed
Do not use static singleton
1 parent cfbde0e commit 3b4a667

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Config/XmlConfig.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,28 @@
88

99
class XmlConfig extends DataConfig
1010
{
11+
private array $componentDefinitions = [];
12+
1113
/**
1214
* @return ComponentDefinition[]
1315
*/
1416
public function getComponentDefinitions(): array
1517
{
16-
static $componentDefinitions = null;
17-
if (!empty($componentDefinitions)) {
18-
return $componentDefinitions;
18+
if (!empty($this->componentDefinitions)) {
19+
return $this->componentDefinitions;
1920
}
2021

21-
$componentDefinitions = [];
2222
$componentsData = (array)$this->get('components');
2323
foreach ($componentsData as $componentData) {
2424
if (empty($componentData)) {
2525
continue;
2626
}
2727

2828
$name = $componentData['name'];
29-
$componentDefinitions[$name] = $this->createComponentDefinition($componentData);
29+
$this->componentDefinitions[$name] = $this->createComponentDefinition($componentData);
3030
}
3131

32-
return $componentDefinitions;
32+
return $this->componentDefinitions;
3333
}
3434

3535
/**

0 commit comments

Comments
 (0)