コード例 #1
0
 private function loadRestriction(Type $type, DOMElement $node)
 {
     $restriction = new Restriction();
     $type->setRestriction($restriction);
     if ($node->hasAttribute("base")) {
         $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
         $restriction->setBase($restrictedType);
     } else {
         $addCallback = function ($restType) use($restriction) {
             $restriction->setBase($restType);
         };
         foreach ($node->childNodes as $childNode) {
             switch ($childNode->localName) {
                 case 'simpleType':
                     call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
                     break;
             }
         }
     }
     foreach ($node->childNodes as $childNode) {
         if (in_array($childNode->localName, ['enumeration', 'pattern', 'length', 'minLength', 'maxLength', 'minInclusive', 'maxInclusive', 'minExclusive', 'maxExclusive', 'fractionDigits', 'totalDigits', 'whiteSpace'], true)) {
             $restriction->addCheck($childNode->localName, ['value' => $childNode->getAttribute("value"), 'doc' => $this->getDocumentation($childNode)]);
         }
     }
 }