Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

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