| Conditions | 4 |
| Paths | 6 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4.128 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 1 | public function setCache($cache) : self |
|
| 42 | { |
||
| 43 | 1 | if (is_string($cache)) { |
|
| 44 | 1 | $this->cache = CacheFactory::make($cache); |
|
| 45 | 1 | } elseif ($cache instanceof Cacheable) { |
|
| 46 | 1 | $this->cache = $cache; |
|
| 47 | } |
||
| 48 | |||
| 49 | try { |
||
| 50 | 1 | $prefix = 'tus:' . strtolower((new \ReflectionClass(static::class))->getShortName()) . ':'; |
|
| 51 | } catch (\ReflectionException $e) { |
||
| 52 | $prefix = 'tus:'; |
||
| 53 | } |
||
| 54 | |||
| 55 | 1 | $this->cache->setPrefix($prefix); |
|
| 56 | |||
| 57 | 1 | return $this; |
|
| 58 | } |
||
| 94 |