| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | 2 | public static function buildFromHeaders(array $headers) |
|
| 20 | { |
||
| 21 | 2 | $requiredKeys = ['playhead', 'offset', 'size']; |
|
| 22 | |||
| 23 | 2 | foreach($requiredKeys as $key) |
|
| 24 | { |
||
| 25 | 2 | if(! isset($headers[$key])) |
|
| 26 | 2 | { |
|
| 27 | 1 | throw new \InvalidArgumentException("Missing $key in chunk metadata"); |
|
| 28 | } |
||
| 29 | 1 | } |
|
| 30 | |||
| 31 | 1 | return new self($headers['playhead'], $headers['offset'], $headers['size']); |
|
| 32 | } |
||
| 33 | |||
| 58 |