Code Duplication    Length = 15-19 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 559-577 (lines=19) @@
556
557
    private function loadList(SimpleType $type, DOMElement $node)
558
    {
559
        if ($node->hasAttribute("itemType")) {
560
            /**
561
            * @var SimpleType $listType
562
            */
563
            $listType = $this->findSomeType($type, $node, 'itemType');
564
            $type->setList($listType);
565
        } else {
566
            $addCallback = function (SimpleType $list) use ($type) {
567
                $type->setList($list);
568
            };
569
570
            foreach ($node->childNodes as $childNode) {
571
                switch ($childNode->localName) {
572
                    case 'simpleType':
573
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
574
                        break;
575
                }
576
            }
577
        }
578
    }
579
580
    /**
@@ 754-768 (lines=15) @@
751
    {
752
        $restriction = new Restriction();
753
        $type->setRestriction($restriction);
754
        if ($node->hasAttribute("base")) {
755
            $this->findAndSetSomeBase($type, $restriction, $node);
756
        } else {
757
            $addCallback = function (Type $restType) use ($restriction) {
758
                $restriction->setBase($restType);
759
            };
760
761
            foreach ($node->childNodes as $childNode) {
762
                switch ($childNode->localName) {
763
                    case 'simpleType':
764
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
765
                        break;
766
                }
767
            }
768
        }
769
        foreach ($node->childNodes as $childNode) {
770
            if (in_array($childNode->localName,
771
                [