Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | 1 | public function create(array $cacheSettings) |
|
26 | { |
||
27 | $config = new Config($cacheSettings); |
||
28 | |||
29 | $class = sprintf('\Pcelta\Doctrine\Cache\Factory\%sFactory', $config->getAdapterName()); |
||
30 | |||
31 | 1 | if (!class_exists($class)) { |
|
32 | throw new InvalidCacheConfig('Adapter not found'); |
||
33 | 1 | } |
|
34 | 1 | ||
35 | /** @var Factory\AbstractFactory $factory */ |
||
36 | $this->factory = new $class(); |
||
37 | return $this->factory->create($config); |
||
38 | } |
||
39 | } |
||
40 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: