| Total Complexity | 7 | 
| Total Lines | 39 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 11 | final class Substring implements WordConverter  | 
            ||
| 12 | { | 
            ||
| 13 | /**  | 
            ||
| 14 | * @var int Minimum substring length.  | 
            ||
| 15 | */  | 
            ||
| 16 | private $minLength;  | 
            ||
| 17 | |||
| 18 | /**  | 
            ||
| 19 | * @var int|null Maximum substring length.  | 
            ||
| 20 | */  | 
            ||
| 21 | private $maxLength;  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * @param int $minLength Ignore substrings shorter thant this.  | 
            ||
| 25 | * @param int|null $maxLength Ignore substrings longer than this.  | 
            ||
| 26 | */  | 
            ||
| 27 | 7 | public function __construct(int $minLength = 3, ?int $maxLength = 25)  | 
            |
| 28 |     { | 
            ||
| 29 | 7 |         if ($minLength < 1) { | 
            |
| 30 | 2 |             throw new InvalidArgumentException('Min length must be positive.'); | 
            |
| 31 | }  | 
            ||
| 32 | 5 |         if ($maxLength !== null && $maxLength < $minLength) { | 
            |
| 33 | 1 |             throw new InvalidArgumentException('Max length cannot be smaller than min length.'); | 
            |
| 34 | }  | 
            ||
| 35 | |||
| 36 | 4 | $this->minLength = $minLength;  | 
            |
| 37 | 4 | $this->maxLength = $maxLength;  | 
            |
| 38 | 4 | }  | 
            |
| 39 | |||
| 40 | /**  | 
            ||
| 41 |      * {@inheritDoc} | 
            ||
| 42 | */  | 
            ||
| 43 | 4 | public function convert(string $word): Traversable  | 
            |
| 50 | }  | 
            ||
| 51 | }  | 
            ||
| 54 |