| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 23 | 2 | public static function buildFromHeaders(array $headers) |
|
| 24 | { |
||
| 25 | 2 | $requiredKeys = ['uuid', 'size', 'nbChunks', 'checksum']; |
|
| 26 | |||
| 27 | 2 | foreach($requiredKeys as $key) |
|
| 28 | { |
||
| 29 | 2 | if(! isset($headers[$key])) |
|
| 30 | 2 | { |
|
| 31 | 1 | throw new \InvalidArgumentException("Missing $key in chunked message metadata"); |
|
| 32 | } |
||
| 33 | 1 | } |
|
| 34 | |||
| 35 | 1 | return new self(new Uuid($headers['uuid']), $headers['size'], $headers['nbChunks'], $headers['checksum']); |
|
| 36 | } |
||
| 37 | |||
| 68 |