1 | <?php declare(strict_types=1); |
||
32 | class CacheSettingsProvider implements CacheSettingsProviderInterface |
||
33 | { |
||
34 | /** Internal data index */ |
||
35 | const KEY_APPLICATION_CONFIGURATION = 0; |
||
36 | |||
37 | /** Internal data index */ |
||
38 | const KEY_CORE_DATA = self::KEY_APPLICATION_CONFIGURATION + 1; |
||
39 | |||
40 | /** Internal data index */ |
||
41 | const KEY_SETTINGS_MAP = self::KEY_CORE_DATA + 1; |
||
42 | |||
43 | /** Internal data index */ |
||
44 | const KEY_SETTINGS_DATA = self::KEY_SETTINGS_MAP + 1; |
||
45 | |||
46 | /** Internal data index */ |
||
47 | const KEY_AMBIGUOUS_MAP = self::KEY_SETTINGS_DATA + 1; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | private $appConfig = []; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | private $coreData = []; |
||
58 | |||
59 | /** |
||
60 | * @var array |
||
61 | */ |
||
62 | private $settingsMap = []; |
||
63 | |||
64 | /** |
||
65 | * @var array |
||
66 | */ |
||
67 | private $settingsData = []; |
||
68 | |||
69 | /** |
||
70 | * @var array |
||
71 | */ |
||
72 | private $ambiguousMap = []; |
||
73 | |||
74 | 3 | /** |
|
75 | * @inheritdoc |
||
76 | 3 | */ |
|
77 | 2 | public function get(string $className): array |
|
90 | |||
91 | 1 | /** |
|
92 | * @inheritdoc |
||
93 | 1 | */ |
|
94 | public function getApplicationConfiguration(): array |
||
98 | |||
99 | 2 | /** |
|
100 | * @inheritdoc |
||
101 | 2 | */ |
|
102 | public function getCoreData(): array |
||
106 | |||
107 | 3 | /** |
|
108 | * @inheritdoc |
||
109 | 3 | */ |
|
110 | public function has(string $className): bool |
||
116 | |||
117 | 1 | /** |
|
118 | * @inheritdoc |
||
119 | 1 | */ |
|
120 | public function isAmbiguous(string $className): bool |
||
126 | |||
127 | /** |
||
128 | * @param ApplicationConfigurationInterface $appConfig |
||
129 | * @param CoreData $coreData |
||
130 | * @param InstanceSettingsProvider $provider |
||
131 | * |
||
132 | * @return self |
||
133 | 6 | * |
|
134 | * @throws ReflectionException |
||
135 | */ |
||
136 | public function setInstanceSettings( |
||
151 | |||
152 | 2 | /** |
|
153 | * @inheritdoc |
||
154 | */ |
||
155 | 2 | public function serialize(): array |
|
165 | |||
166 | 6 | /** |
|
167 | * @inheritdoc |
||
168 | */ |
||
169 | 6 | public function unserialize(array $serialized): void |
|
179 | } |
||
180 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: