Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

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