| Total Complexity | 6 | 
| Total Lines | 42 | 
| Duplicated Lines | 0 % | 
| Coverage | 100% | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 15 | final class Stream implements Type  | 
            ||
| 16 | { | 
            ||
| 17 | private const PATTERN = '~^stream<(?<type>.+)>$~';  | 
            ||
| 18 | private $type;  | 
            ||
| 19 | |||
| 20 | 4 | public function __construct(string $type)  | 
            |
| 23 | 4 | }  | 
            |
| 24 | |||
| 25 | /**  | 
            ||
| 26 |      * {@inheritdoc} | 
            ||
| 27 | */  | 
            ||
| 28 | 2 | public function accepts($value): bool  | 
            |
| 29 |     { | 
            ||
| 30 | 2 |         if (!$value instanceof StreamInterface) { | 
            |
| 31 | 1 | return false;  | 
            |
| 32 | }  | 
            ||
| 33 | |||
| 34 | 2 | return (string) $value->type() === $this->type;  | 
            |
| 35 | }  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 |      * {@inheritdoc} | 
            ||
| 39 | */  | 
            ||
| 40 | 12 | public static function fromString(Str $value): Type  | 
            |
| 41 |     { | 
            ||
| 42 | 12 |         if (!$value->matches(self::PATTERN)) { | 
            |
| 43 | 10 | throw new ValueNotSupported((string) $value);  | 
            |
| 44 | }  | 
            ||
| 45 | |||
| 46 | 2 | $components = $value->capture(self::PATTERN);  | 
            |
| 47 | |||
| 48 | 2 |         return new self((string) $components->get('type')); | 
            |
| 49 | }  | 
            ||
| 50 | |||
| 51 | /**  | 
            ||
| 52 |      * {@inheritdoc} | 
            ||
| 53 | */  | 
            ||
| 54 | 1 | public function __toString(): string  | 
            |
| 57 | }  | 
            ||
| 58 | }  | 
            ||
| 59 |