| Total Complexity | 6 | 
| Total Lines | 32 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 9 | final class Pattern  | 
            ||
| 10 | { | 
            ||
| 11 | /** @var string */  | 
            ||
| 12 | private $pattern;  | 
            ||
| 13 | |||
| 14 | /** @var string */  | 
            ||
| 15 | private $regex;  | 
            ||
| 16 | |||
| 17 | 675 | public function __construct(string $pattern)  | 
            |
| 18 |     { | 
            ||
| 19 | 675 | $this->pattern = $pattern;  | 
            |
| 20 | |||
| 21 | 675 |         if (isset($this->pattern[0]) && $this->pattern[0] === '/') { | 
            |
| 22 | 146 | $this->regex = $this->pattern;  | 
            |
| 23 |         } else { | 
            ||
| 24 | 674 | $this->regex = '/' . $this->pattern . '/i';  | 
            |
| 25 | }  | 
            ||
| 26 | 675 | }  | 
            |
| 27 | |||
| 28 | 669 | public function getPattern() : string  | 
            |
| 29 |     { | 
            ||
| 30 | 669 | return $this->pattern;  | 
            |
| 31 | }  | 
            ||
| 32 | |||
| 33 | 288 | public function getRegex() : string  | 
            |
| 36 | }  | 
            ||
| 37 | |||
| 38 | 285 | public function matches(string $word) : bool  | 
            |
| 41 | }  | 
            ||
| 42 | }  | 
            ||
| 43 |