Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 418-432 (lines=15) @@
415
416
    private function loadList(SimpleType $type, DOMElement $node)
417
    {
418
        if ($node->hasAttribute("itemType")) {
419
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType")));
420
        } else {
421
            $addCallback = function ($list) use ($type) {
422
                $type->setList($list);
423
            };
424
425
            foreach ($node->childNodes as $childNode) {
426
                switch ($childNode->localName) {
427
                    case 'simpleType':
428
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
429
                        break;
430
                }
431
            }
432
        }
433
    }
434
435
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 516-531 (lines=16) @@
513
    {
514
        $restriction = new Restriction();
515
        $type->setRestriction($restriction);
516
        if ($node->hasAttribute("base")) {
517
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
518
            $restriction->setBase($restrictedType);
519
        } else {
520
            $addCallback = function ($restType) use ($restriction) {
521
                $restriction->setBase($restType);
522
            };
523
524
            foreach ($node->childNodes as $childNode) {
525
                switch ($childNode->localName) {
526
                    case 'simpleType':
527
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
528
                        break;
529
                }
530
            }
531
        }
532
        foreach ($node->childNodes as $childNode) {
533
            if (in_array($childNode->localName,
534
                [