Code Duplication    Length = 19-19 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 557-575 (lines=19) @@
554
555
    private function loadList(SimpleType $type, DOMElement $node)
556
    {
557
        if ($node->hasAttribute("itemType")) {
558
            /**
559
            * @var SimpleType $listType
560
            */
561
            $listType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType"));
562
            $type->setList($listType);
563
        } else {
564
            $addCallback = function (SimpleType $list) use ($type) {
565
                $type->setList($list);
566
            };
567
568
            foreach ($node->childNodes as $childNode) {
569
                switch ($childNode->localName) {
570
                    case 'simpleType':
571
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
572
                        break;
573
                }
574
            }
575
        }
576
    }
577
578
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 700-718 (lines=19) @@
697
    {
698
        $restriction = new Restriction();
699
        $type->setRestriction($restriction);
700
        if ($node->hasAttribute("base")) {
701
            /**
702
            * @var Type $restrictedType
703
            */
704
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
705
            $restriction->setBase($restrictedType);
706
        } else {
707
            $addCallback = function (Type $restType) use ($restriction) {
708
                $restriction->setBase($restType);
709
            };
710
711
            foreach ($node->childNodes as $childNode) {
712
                switch ($childNode->localName) {
713
                    case 'simpleType':
714
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
715
                        break;
716
                }
717
            }
718
        }
719
        foreach ($node->childNodes as $childNode) {
720
            if (in_array($childNode->localName,
721
                [