Code Duplication    Length = 19-19 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 534-552 (lines=19) @@
531
532
    private function loadList(SimpleType $type, DOMElement $node)
533
    {
534
        if ($node->hasAttribute("itemType")) {
535
            /**
536
            * @var SimpleType $listType
537
            */
538
            $listType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType"));
539
            $type->setList($listType);
540
        } else {
541
            $addCallback = function (SimpleType $list) use ($type) {
542
                $type->setList($list);
543
            };
544
545
            foreach ($node->childNodes as $childNode) {
546
                switch ($childNode->localName) {
547
                    case 'simpleType':
548
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
549
                        break;
550
                }
551
            }
552
        }
553
    }
554
555
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 683-701 (lines=19) @@
680
    {
681
        $restriction = new Restriction();
682
        $type->setRestriction($restriction);
683
        if ($node->hasAttribute("base")) {
684
            /**
685
            * @var Type $restrictedType
686
            */
687
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
688
            $restriction->setBase($restrictedType);
689
        } else {
690
            $addCallback = function (Type $restType) use ($restriction) {
691
                $restriction->setBase($restType);
692
            };
693
694
            foreach ($node->childNodes as $childNode) {
695
                switch ($childNode->localName) {
696
                    case 'simpleType':
697
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
698
                        break;
699
                }
700
            }
701
        }
702
        foreach ($node->childNodes as $childNode) {
703
            if (in_array($childNode->localName,
704
                [