| Conditions | 4 |
| Paths | 4 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 4 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 8 | public static function fromString(string $rangeSet): RangeSet |
|
| 22 | { |
||
| 23 | 8 | $plainRangeSet = mb_convert_encoding($rangeSet, 'ISO-8859-1', 'UTF-8'); |
|
| 24 | 8 | if ($plainRangeSet === $rangeSet) { |
|
| 25 | 8 | if (preg_match('{^' . Rfc7233::BYTE_RANGES_SPECIFIER . '$}', $rangeSet) === 1) { |
|
| 26 | 2 | return ByteRangeSet::fromString($rangeSet); |
|
| 27 | } |
||
| 28 | |||
| 29 | 6 | if (preg_match('{^' . Rfc7233::OTHER_RANGES_SPECIFIER . '$}', $rangeSet) === 1) { |
|
| 30 | 1 | return OtherRangeSet::fromString($rangeSet); |
|
| 31 | } |
||
| 32 | } |
||
| 33 | |||
| 34 | 5 | throw new InvalidArgumentException('Invalid set of ranges: ' . $rangeSet); |
|
| 35 | } |
||
| 37 |