Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 451-465 (lines=15) @@
448
449
    private function loadList(SimpleType $type, DOMElement $node)
450
    {
451
        if ($node->hasAttribute("itemType")) {
452
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType")));
453
        } else {
454
            $addCallback = function ($list) use ($type) {
455
                $type->setList($list);
456
            };
457
458
            foreach ($node->childNodes as $childNode) {
459
                switch ($childNode->localName) {
460
                    case 'simpleType':
461
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
462
                        break;
463
                }
464
            }
465
        }
466
    }
467
468
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 549-564 (lines=16) @@
546
    {
547
        $restriction = new Restriction();
548
        $type->setRestriction($restriction);
549
        if ($node->hasAttribute("base")) {
550
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
551
            $restriction->setBase($restrictedType);
552
        } else {
553
            $addCallback = function ($restType) use ($restriction) {
554
                $restriction->setBase($restType);
555
            };
556
557
            foreach ($node->childNodes as $childNode) {
558
                switch ($childNode->localName) {
559
                    case 'simpleType':
560
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
561
                        break;
562
                }
563
            }
564
        }
565
        foreach ($node->childNodes as $childNode) {
566
            if (in_array($childNode->localName,
567
                [