| Conditions | 6 |
| Paths | 8 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 54 | 6 | private function parse(array $artifacts) |
|
| 55 | { |
||
| 56 | // quick validation: if an "object" and it has the "paths" attribute, this is the list |
||
| 57 | 6 | if (isset($artifacts['paths']) && is_array($artifacts['paths'])) { |
|
| 58 | 1 | $artifacts = $artifacts['paths']; |
|
| 59 | } |
||
| 60 | |||
| 61 | // quick validation: requires a list of strings which must not be empty (can't in YAML anyway) |
||
| 62 | 6 | if (!count($artifacts)) { |
|
| 63 | 1 | throw new ParseException("'artifacts' requires a list"); |
|
| 64 | } |
||
| 65 | |||
| 66 | 5 | foreach ($artifacts as $index => $string) { |
|
| 67 | 5 | if (!is_string($string)) { |
|
| 68 | 1 | throw new ParseException(sprintf( |
|
| 69 | "'artifacts' requires a list of paths", |
||
| 70 | $index |
||
| 71 | )); |
||
| 72 | } |
||
| 73 | } |
||
| 74 | |||
| 75 | 4 | $this->paths = $artifacts; |
|
| 76 | } |
||
| 78 |