| Conditions | 5 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 14 |
| Lines | 10 |
| Ratio | 38.46 % |
| Tests | 17 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | 68 | public function normalize(stdClass $schema, Context $context, Walker $walker) |
|
| 37 | { |
||
| 38 | 68 | $keyword = $this->keywords()[0]; |
|
| 39 | 68 | $context->enterNode($keyword); |
|
| 40 | |||
| 41 | 68 | if (!is_array($schema->{$keyword})) { |
|
| 42 | 3 | throw new InvalidTypeException($context, Types::TYPE_ARRAY); |
|
| 43 | } |
||
| 44 | |||
| 45 | 65 | if (count($schema->{$keyword}) === 0) { |
|
| 46 | 3 | throw new EmptyArrayException($context); |
|
| 47 | 1 | } |
|
| 48 | |||
| 49 | 62 | View Code Duplication | foreach ($schema->{$keyword} as $index => $subSchema) { |
| 50 | 62 | $context->enterNode($index); |
|
| 51 | |||
| 52 | 62 | if (!is_object($subSchema)) { |
|
| 53 | 3 | throw new InvalidTypeException($context, Types::TYPE_OBJECT); |
|
| 54 | } |
||
| 55 | |||
| 56 | 62 | $walker->parseSchema($subSchema, $context); |
|
| 57 | 62 | $context->leaveNode(); |
|
| 58 | 62 | } |
|
| 59 | |||
| 60 | 59 | $context->leaveNode(); |
|
| 61 | 59 | } |
|
| 62 | } |
||
| 63 |