Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 521-536 (lines=16) @@
518
    {
519
        $restriction = new Restriction();
520
        $type->setRestriction($restriction);
521
        if ($node->hasAttribute('base')) {
522
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute('base'));
523
            $restriction->setBase($restrictedType);
524
        } else {
525
            $addCallback = function ($restType) use ($restriction) {
526
                $restriction->setBase($restType);
527
            };
528
529
            foreach ($node->childNodes as $childNode) {
530
                switch ($childNode->localName) {
531
                    case 'simpleType':
532
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
533
                        break;
534
                }
535
            }
536
        }
537
        foreach ($node->childNodes as $childNode) {
538
            if (in_array($childNode->localName,
539
                [
@@ 424-438 (lines=15) @@
421
422
    private function loadList(SimpleType $type, DOMElement $node)
423
    {
424
        if ($node->hasAttribute('itemType')) {
425
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute('itemType')));
426
        } else {
427
            $addCallback = function ($list) use ($type) {
428
                $type->setList($list);
429
            };
430
431
            foreach ($node->childNodes as $childNode) {
432
                switch ($childNode->localName) {
433
                    case 'simpleType':
434
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
435
                        break;
436
                }
437
            }
438
        }
439
    }
440
441
    private function loadUnion(SimpleType $type, DOMElement $node)