| Conditions | 4 |
| Paths | 1 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public function register(Application $app) |
||
| 18 | { |
||
| 19 | $app[$this->prefix] = $app->share( |
||
| 20 | function () use ($app) { |
||
| 21 | |||
| 22 | if (!isset($app['config']['cache'])) { |
||
| 23 | throw new InvalidCacheConfigException('Cache Config Not Defined'); |
||
| 24 | } |
||
| 25 | |||
| 26 | $cacheSettings = $app['config']['cache']; |
||
| 27 | $cacheClassName = sprintf('\Doctrine\Common\Cache\%sCache', $cacheSettings['adapter']); |
||
| 28 | |||
| 29 | if (!class_exists($cacheClassName)) { |
||
| 30 | throw new InvalidCacheConfigException('Cache Adapter Not Supported!'); |
||
| 31 | } |
||
| 32 | |||
| 33 | $cacheAdapter = new $cacheClassName(); |
||
| 34 | |||
| 35 | if ($cacheSettings['connectable'] === true) { |
||
| 36 | $this->addConnection($cacheAdapter, $cacheSettings); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $cacheAdapter; |
||
| 40 | } |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | |||
| 61 |