Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

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