Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 443-457 (lines=15) @@
440
441
    private function loadList(SimpleType $type, DOMElement $node)
442
    {
443
        if ($node->hasAttribute("itemType")) {
444
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType")));
445
        } else {
446
            $addCallback = function ($list) use ($type) {
447
                $type->setList($list);
448
            };
449
450
            foreach ($node->childNodes as $childNode) {
451
                switch ($childNode->localName) {
452
                    case 'simpleType':
453
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
454
                        break;
455
                }
456
            }
457
        }
458
    }
459
460
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 541-556 (lines=16) @@
538
    {
539
        $restriction = new Restriction();
540
        $type->setRestriction($restriction);
541
        if ($node->hasAttribute("base")) {
542
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
543
            $restriction->setBase($restrictedType);
544
        } else {
545
            $addCallback = function ($restType) use ($restriction) {
546
                $restriction->setBase($restType);
547
            };
548
549
            foreach ($node->childNodes as $childNode) {
550
                switch ($childNode->localName) {
551
                    case 'simpleType':
552
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
553
                        break;
554
                }
555
            }
556
        }
557
        foreach ($node->childNodes as $childNode) {
558
            if (in_array($childNode->localName,
559
                [