Code Duplication    Length = 19-19 lines in 2 locations

src/SchemaReader.php 2 locations

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