| Total Complexity | 10 | 
| Total Lines | 89 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 8 | final class CacheKey  | 
            ||
| 9 | { | 
            ||
| 10 | /**  | 
            ||
| 11 | * @var string|callable  | 
            ||
| 12 | */  | 
            ||
| 13 | private $namespace;  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 14 | |||
| 15 | /**  | 
            ||
| 16 | * @var string|callable  | 
            ||
| 17 | */  | 
            ||
| 18 | private $key;  | 
            ||
| 19 | |||
| 20 | /**  | 
            ||
| 21 | * @var integer  | 
            ||
| 22 | */  | 
            ||
| 23 | private $lifetime = 0;  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * CacheKey constructor.  | 
            ||
| 27 | * @param callable|string $namespace  | 
            ||
| 28 | * @param callable|string $key  | 
            ||
| 29 | * @param int $lifetime  | 
            ||
| 30 | */  | 
            ||
| 31 | 556 | public function __construct($namespace = null, $key = null, int $lifetime = 0)  | 
            |
| 36 | 556 | }  | 
            |
| 37 | |||
| 38 | /**  | 
            ||
| 39 | * @return string  | 
            ||
| 40 | */  | 
            ||
| 41 | 34 | public function namespace(): string  | 
            |
| 42 |     { | 
            ||
| 43 | 34 | return is_string($this->namespace) ? $this->namespace : ($this->namespace)();  | 
            |
| 44 | }  | 
            ||
| 45 | |||
| 46 | /**  | 
            ||
| 47 | * @param string|callable $namespace  | 
            ||
| 48 | *  | 
            ||
| 49 | * @return $this  | 
            ||
| 50 | */  | 
            ||
| 51 | 11 | public function setNamespace($namespace): CacheKey  | 
            |
| 52 |     { | 
            ||
| 53 | 11 | $this->namespace = $namespace;  | 
            |
| 54 | 11 | return $this;  | 
            |
| 55 | }  | 
            ||
| 56 | |||
| 57 | /**  | 
            ||
| 58 | * @return string  | 
            ||
| 59 | */  | 
            ||
| 60 | 34 | public function key(): ?string  | 
            |
| 61 |     { | 
            ||
| 62 | 34 | return is_string($this->key) ? $this->key : ($this->key)();  | 
            |
| 63 | }  | 
            ||
| 64 | |||
| 65 | /**  | 
            ||
| 66 | * @param string|callable $key  | 
            ||
| 67 | *  | 
            ||
| 68 | * @return $this  | 
            ||
| 69 | */  | 
            ||
| 70 | 11 | public function setKey($key): CacheKey  | 
            |
| 71 |     { | 
            ||
| 72 | 11 | $this->key = $key;  | 
            |
| 73 | 11 | return $this;  | 
            |
| 74 | }  | 
            ||
| 75 | |||
| 76 | /**  | 
            ||
| 77 | * @return int  | 
            ||
| 78 | */  | 
            ||
| 79 | 17 | public function lifetime(): int  | 
            |
| 80 |     { | 
            ||
| 81 | 17 | return $this->lifetime;  | 
            |
| 82 | }  | 
            ||
| 83 | |||
| 84 | /**  | 
            ||
| 85 | * @param int $lifetime  | 
            ||
| 86 | * @return $this  | 
            ||
| 87 | */  | 
            ||
| 88 | 1 | public function setLifetime(int $lifetime): CacheKey  | 
            |
| 92 | }  | 
            ||
| 93 | |||
| 94 | 23 | public function valid(): bool  | 
            |
| 97 | }  | 
            ||
| 98 | }  | 
            ||
| 99 |