| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 26 | 2 | public function create(array $cacheSettings) |
|
| 27 | { |
||
| 28 | 2 | $config = new Config($cacheSettings); |
|
| 29 | |||
| 30 | 2 | $class = sprintf('\Pcelta\Doctrine\Cache\Factory\%sFactory', $config->getAdapterName()); |
|
| 31 | |||
| 32 | 2 | if (!class_exists($class)) { |
|
| 33 | 1 | throw new InvalidCacheConfig('Adapter not found'); |
|
| 34 | } |
||
| 35 | |||
| 36 | /* @var Factory\AbstractFactory $factory */ |
||
| 37 | 1 | $this->factory = new $class(); |
|
| 38 | |||
| 39 | 1 | return $this->factory->create($config); |
|
| 40 | } |
||
| 41 | } |
||
| 42 |
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: