Code Duplication    Length = 19-19 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 558-576 (lines=19) @@
555
556
    private function loadList(SimpleType $type, DOMElement $node)
557
    {
558
        if ($node->hasAttribute("itemType")) {
559
            /**
560
            * @var SimpleType $listType
561
            */
562
            $listType = $this->findSomeType($type, $node, 'itemType');
563
            $type->setList($listType);
564
        } else {
565
            $addCallback = function (SimpleType $list) use ($type) {
566
                $type->setList($list);
567
            };
568
569
            foreach ($node->childNodes as $childNode) {
570
                switch ($childNode->localName) {
571
                    case 'simpleType':
572
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
573
                        break;
574
                }
575
            }
576
        }
577
    }
578
579
    /**
@@ 741-759 (lines=19) @@
738
    {
739
        $restriction = new Restriction();
740
        $type->setRestriction($restriction);
741
        if ($node->hasAttribute("base")) {
742
            /**
743
            * @var Type $restrictedType
744
            */
745
            $restrictedType = $this->findSomeType($type, $node, 'base');
746
            $restriction->setBase($restrictedType);
747
        } else {
748
            $addCallback = function (Type $restType) use ($restriction) {
749
                $restriction->setBase($restType);
750
            };
751
752
            foreach ($node->childNodes as $childNode) {
753
                switch ($childNode->localName) {
754
                    case 'simpleType':
755
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
756
                        break;
757
                }
758
            }
759
        }
760
        foreach ($node->childNodes as $childNode) {
761
            if (in_array($childNode->localName,
762
                [