Code Duplication    Length = 19-19 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 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
                [
@@ 544-562 (lines=19) @@
541
542
    private function loadList(SimpleType $type, DOMElement $node)
543
    {
544
        if ($node->hasAttribute("itemType")) {
545
            /**
546
            * @var SimpleType $listType
547
            */
548
            $listType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType"));
549
            $type->setList($listType);
550
        } else {
551
            $addCallback = function (SimpleType $list) use ($type) {
552
                $type->setList($list);
553
            };
554
555
            foreach ($node->childNodes as $childNode) {
556
                switch ($childNode->localName) {
557
                    case 'simpleType':
558
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
559
                        break;
560
                }
561
            }
562
        }
563
    }
564
565
    private function loadUnion(SimpleType $type, DOMElement $node)