These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Bankiru\Api\Doctrine; |
||
4 | |||
5 | use Bankiru\Api\Doctrine\Cache\CacheConfiguration; |
||
6 | use Bankiru\Api\Doctrine\Cache\CacheConfigurationInterface; |
||
7 | use Bankiru\Api\Doctrine\Type\TypeRegistryInterface; |
||
8 | use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; |
||
9 | use Psr\Cache\CacheItemPoolInterface; |
||
10 | use Psr\Log\LoggerInterface; |
||
11 | use Psr\Log\NullLogger; |
||
12 | |||
13 | class Configuration |
||
14 | { |
||
15 | /** @var EntityMetadataFactory */ |
||
16 | private $metadataFactory; |
||
17 | /** @var MappingDriver */ |
||
18 | private $driver; |
||
19 | /** @var ClientRegistryInterface */ |
||
20 | private $clientRegistry; |
||
21 | /** @var ApiFactoryRegistryInterface */ |
||
22 | private $factoryRegistry; |
||
23 | /** @var string */ |
||
24 | private $proxyDir; |
||
25 | /** @var string */ |
||
26 | private $proxyNamespace; |
||
27 | /** @var bool */ |
||
28 | private $autogenerateProxies = true; |
||
29 | /** @var TypeRegistryInterface */ |
||
30 | private $typeRegistry; |
||
31 | /** @var array */ |
||
32 | private $cacheConfiguration = []; |
||
33 | /** @var CacheItemPoolInterface */ |
||
34 | private $apiCache; |
||
35 | /** @var LoggerInterface */ |
||
36 | private $apiCacheLogger; |
||
37 | /** @var CacheConfigurationInterface[] */ |
||
38 | private $cacheConfigurationCache = []; |
||
39 | |||
40 | /** |
||
41 | * Configuration constructor. |
||
42 | */ |
||
43 | 20 | public function __construct() |
|
44 | { |
||
45 | 20 | $this->apiCacheLogger = new NullLogger(); |
|
46 | 20 | } |
|
47 | |||
48 | /** |
||
49 | * @return ClientRegistryInterface |
||
50 | */ |
||
51 | 20 | public function getClientRegistry() |
|
52 | { |
||
53 | 20 | return $this->clientRegistry; |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * @param ClientRegistryInterface $clientRegistry |
||
58 | */ |
||
59 | 20 | public function setClientRegistry($clientRegistry) |
|
60 | { |
||
61 | 20 | $this->clientRegistry = $clientRegistry; |
|
62 | 20 | } |
|
63 | |||
64 | /** |
||
65 | * @return ApiFactoryRegistryInterface |
||
66 | */ |
||
67 | 19 | public function getFactoryRegistry() |
|
68 | { |
||
69 | 19 | return $this->factoryRegistry; |
|
70 | } |
||
71 | |||
72 | /** |
||
73 | * @param ApiFactoryRegistryInterface $factoryRegistry |
||
74 | */ |
||
75 | 20 | public function setFactoryRegistry(ApiFactoryRegistryInterface $factoryRegistry) |
|
76 | { |
||
77 | 20 | $this->factoryRegistry = $factoryRegistry; |
|
78 | 20 | } |
|
79 | |||
80 | /** |
||
81 | * @return LoggerInterface |
||
82 | */ |
||
83 | 1 | public function getApiCacheLogger() |
|
84 | { |
||
85 | 1 | return $this->apiCacheLogger; |
|
86 | } |
||
87 | |||
88 | /** |
||
89 | * @param LoggerInterface $apiCacheLogger |
||
90 | */ |
||
91 | 1 | public function setApiCacheLogger($apiCacheLogger) |
|
92 | { |
||
93 | 1 | $this->apiCacheLogger = $apiCacheLogger; |
|
94 | 1 | } |
|
95 | |||
96 | /** |
||
97 | * @return CacheItemPoolInterface |
||
98 | */ |
||
99 | 1 | public function getApiCache() |
|
100 | { |
||
101 | 1 | return $this->apiCache; |
|
102 | } |
||
103 | |||
104 | /** |
||
105 | * @param CacheItemPoolInterface|null $apiCache |
||
106 | */ |
||
107 | 1 | public function setApiCache(CacheItemPoolInterface $apiCache = null) |
|
108 | { |
||
109 | 1 | $this->apiCache = $apiCache; |
|
110 | 1 | } |
|
111 | |||
112 | /** |
||
113 | * Returns class cache configuration |
||
114 | * |
||
115 | * @param $class |
||
116 | * |
||
117 | * @return CacheConfigurationInterface |
||
118 | */ |
||
119 | 19 | public function getCacheConfiguration($class) |
|
120 | { |
||
121 | 19 | if (!array_key_exists($class, $this->cacheConfiguration)) { |
|
122 | 18 | return CacheConfiguration::disabled(); |
|
123 | } |
||
124 | |||
125 | 1 | if (!array_key_exists($class, $this->cacheConfigurationCache)) { |
|
126 | 1 | $this->cacheConfigurationCache[$class] = CacheConfiguration::create($this->cacheConfiguration[$class]); |
|
127 | 1 | } |
|
128 | |||
129 | 1 | return $this->cacheConfigurationCache[$class]; |
|
130 | } |
||
131 | |||
132 | /** |
||
133 | * @param string $class |
||
134 | * @param array $options |
||
135 | */ |
||
136 | 1 | public function setCacheConfiguration($class, array $options = null) |
|
137 | { |
||
138 | 1 | $this->cacheConfiguration[$class] = $options; |
|
139 | |||
140 | 1 | if (null === $this->cacheConfiguration[$class]) { |
|
141 | unset($this->cacheConfiguration[$class]); |
||
142 | } |
||
143 | 1 | } |
|
144 | |||
145 | /** |
||
146 | * |
||
147 | * |
||
148 | * @param string $class |
||
149 | * @param CacheConfigurationInterface $configuration |
||
150 | */ |
||
151 | public function setCacheConfigurationInstance($class, CacheConfigurationInterface $configuration) |
||
152 | { |
||
153 | $this->cacheConfigurationCache[$class] = $configuration; |
||
154 | } |
||
155 | |||
156 | /** |
||
157 | * @return TypeRegistryInterface |
||
158 | */ |
||
159 | 19 | public function getTypeRegistry() |
|
160 | { |
||
161 | 19 | return $this->typeRegistry; |
|
162 | } |
||
163 | |||
164 | /** |
||
165 | * @param TypeRegistryInterface $typeRegistry |
||
166 | */ |
||
167 | 20 | public function setTypeRegistry(TypeRegistryInterface $typeRegistry) |
|
168 | { |
||
169 | 20 | $this->typeRegistry = $typeRegistry; |
|
170 | 20 | } |
|
171 | |||
172 | /** |
||
173 | * @return string |
||
174 | */ |
||
175 | 20 | public function getProxyDir() |
|
176 | { |
||
177 | 20 | return $this->proxyDir; |
|
178 | } |
||
179 | |||
180 | /** |
||
181 | * @param string $proxyDir |
||
182 | */ |
||
183 | 20 | public function setProxyDir($proxyDir) |
|
184 | { |
||
185 | 20 | $this->proxyDir = $proxyDir; |
|
186 | 20 | } |
|
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | 20 | public function getProxyNamespace() |
|
192 | { |
||
193 | 20 | return $this->proxyNamespace; |
|
194 | } |
||
195 | |||
196 | /** |
||
197 | * @param string $proxyNamespace |
||
198 | */ |
||
199 | 20 | public function setProxyNamespace($proxyNamespace) |
|
200 | { |
||
201 | 20 | $this->proxyNamespace = $proxyNamespace; |
|
202 | 20 | } |
|
203 | |||
204 | /** |
||
205 | * @return boolean |
||
206 | */ |
||
207 | 20 | public function isAutogenerateProxies() |
|
208 | { |
||
209 | 20 | return $this->autogenerateProxies; |
|
210 | } |
||
211 | |||
212 | /** |
||
213 | * @param boolean $autogenerateProxies |
||
214 | */ |
||
215 | public function setAutogenerateProxies($autogenerateProxies) |
||
216 | { |
||
217 | $this->autogenerateProxies = $autogenerateProxies; |
||
218 | } |
||
219 | |||
220 | /** |
||
221 | * @return MappingDriver |
||
222 | */ |
||
223 | 20 | public function getDriver() |
|
224 | { |
||
225 | 20 | return $this->driver; |
|
226 | } |
||
227 | |||
228 | /** |
||
229 | * @param MappingDriver $driver |
||
230 | */ |
||
231 | 20 | public function setDriver($driver) |
|
232 | { |
||
233 | 20 | $this->driver = $driver; |
|
234 | 20 | } |
|
235 | |||
236 | /** |
||
237 | * @return EntityMetadataFactory |
||
238 | */ |
||
239 | 20 | public function getMetadataFactory() |
|
240 | { |
||
241 | 20 | return $this->metadataFactory; |
|
242 | } |
||
243 | |||
244 | /** |
||
245 | * @param string $metadataFactory |
||
246 | */ |
||
247 | 20 | public function setMetadataFactory($metadataFactory) |
|
248 | { |
||
249 | 20 | $this->metadataFactory = $metadataFactory; |
|
0 ignored issues
–
show
|
|||
250 | 20 | } |
|
251 | } |
||
252 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..