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