Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0987 |
Changes | 0 |
1 | <?php |
||
48 | 4 | public function create(Config $config) |
|
49 | { |
||
50 | 4 | $this->config = $config; |
|
51 | |||
52 | 4 | $cacheClassName = sprintf($config->getAdapterNamespace(), $this->config->getAdapterName()); |
|
53 | |||
54 | 4 | if (!class_exists($cacheClassName)) { |
|
55 | throw new InvalidCacheConfig('Cache Adapter Not Supported!'); |
||
56 | } |
||
57 | |||
58 | /** @var CacheProvider $cacheProvider */ |
||
59 | 4 | $cacheProvider = new $cacheClassName(); |
|
60 | 4 | if (!$this->isValidConfig($this->config)) { |
|
61 | throw new InvalidCacheConfig('Options Not Supported Passed'); |
||
62 | } |
||
63 | |||
64 | 4 | return $this->decorateWithConnectable($cacheProvider); |
|
65 | } |
||
66 | |||
81 |