| Conditions | 4 |
| Paths | 6 |
| Total Lines | 47 |
| Code Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public static function loadRestriction( |
||
| 46 | SchemaReader $reader, |
||
| 47 | Type $type, |
||
| 48 | DOMElement $node |
||
| 49 | ) { |
||
| 50 | $restriction = new Restriction(); |
||
| 51 | $type->setRestriction($restriction); |
||
| 52 | if ($node->hasAttribute("base")) { |
||
| 53 | $reader->findAndSetSomeBase($type, $restriction, $node); |
||
| 54 | } else { |
||
| 55 | $addCallback = function (Type $restType) use ($restriction) { |
||
| 56 | $restriction->setBase($restType); |
||
| 57 | }; |
||
| 58 | |||
| 59 | Type::loadTypeWithCallbackOnChildNodes( |
||
| 60 | $reader, |
||
| 61 | $type->getSchema(), |
||
| 62 | $node, |
||
| 63 | $addCallback |
||
| 64 | ); |
||
| 65 | } |
||
| 66 | foreach ($node->childNodes as $childNode) { |
||
| 67 | if ( |
||
| 68 | in_array( |
||
| 69 | $childNode->localName, |
||
| 70 | [ |
||
| 71 | 'enumeration', |
||
| 72 | 'pattern', |
||
| 73 | 'length', |
||
| 74 | 'minLength', |
||
| 75 | 'maxLength', |
||
| 76 | 'minInclusive', |
||
| 77 | 'maxInclusive', |
||
| 78 | 'minExclusive', |
||
| 79 | 'maxExclusive', |
||
| 80 | 'fractionDigits', |
||
| 81 | 'totalDigits', |
||
| 82 | 'whiteSpace' |
||
| 83 | ], |
||
| 84 | true |
||
| 85 | ) |
||
| 86 | ) { |
||
| 87 | $restriction->addCheck( |
||
| 88 | $childNode->localName, |
||
| 89 | [ |
||
| 90 | 'value' => $childNode->getAttribute("value"), |
||
| 91 | 'doc' => SchemaReader::getDocumentation($childNode) |
||
| 92 | ] |
||
| 98 |