| Total Complexity | 8 | 
| Total Lines | 66 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 14 | class Password  | 
            ||
| 15 | { | 
            ||
| 16 | /**  | 
            ||
| 17 | * @var string  | 
            ||
| 18 | */  | 
            ||
| 19 | protected $id;  | 
            ||
| 20 | |||
| 21 | /**  | 
            ||
| 22 | * @var int  | 
            ||
| 23 | */  | 
            ||
| 24 | protected $ttl;  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * @var int  | 
            ||
| 28 | */  | 
            ||
| 29 | protected $views;  | 
            ||
| 30 | |||
| 31 | /**  | 
            ||
| 32 | * @var string  | 
            ||
| 33 | */  | 
            ||
| 34 | protected $password;  | 
            ||
| 35 | |||
| 36 | 4 | public function __construct(string $id, string $password, int $ttl, int $views)  | 
            |
| 37 |     { | 
            ||
| 38 | 4 | $this->id = $id;  | 
            |
| 39 | 4 | $this->password = $password;  | 
            |
| 40 | 4 | $this->ttl = $ttl;  | 
            |
| 41 | 4 | $this->views = $views;  | 
            |
| 42 | }  | 
            ||
| 43 | |||
| 44 | 1 | public function getId(): string  | 
            |
| 45 |     { | 
            ||
| 46 | 1 | return $this->id;  | 
            |
| 47 | }  | 
            ||
| 48 | |||
| 49 | 1 | public function getPassword(): string  | 
            |
| 50 |     { | 
            ||
| 51 | 1 | return $this->password;  | 
            |
| 52 | }  | 
            ||
| 53 | |||
| 54 | 1 | public function getTtl(): int  | 
            |
| 55 |     { | 
            ||
| 56 | 1 | return $this->ttl;  | 
            |
| 57 | }  | 
            ||
| 58 | |||
| 59 | 1 | public function getViews(): int  | 
            |
| 62 | }  | 
            ||
| 63 | |||
| 64 | 2 | public function decreaseViews(): void  | 
            |
| 65 |     { | 
            ||
| 66 | 2 |         if (($this->views - 1) >= 0) { | 
            |
| 67 | 2 | $this->views--;  | 
            |
| 68 |         } else { | 
            ||
| 69 | 1 |             throw new \LogicException('Passwords with negative views should be deleted'); | 
            |
| 70 | }  | 
            ||
| 71 | }  | 
            ||
| 72 | |||
| 73 | 1 | public function getJson(): string  | 
            |
| 80 | ]);  | 
            ||
| 81 | }  | 
            ||
| 82 | }  | 
            ||
| 83 |