Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 405-419 (lines=15) @@
402
403
    private function loadList(SimpleType $type, DOMElement $node)
404
    {
405
        if ($node->hasAttribute("itemType")) {
406
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType")));
407
        } else {
408
            $addCallback = function ($list) use ($type) {
409
                $type->setList($list);
410
            };
411
412
            foreach ($node->childNodes as $childNode) {
413
                switch ($childNode->localName) {
414
                    case 'simpleType':
415
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
416
                        break;
417
                }
418
            }
419
        }
420
    }
421
422
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 503-518 (lines=16) @@
500
    {
501
        $restriction = new Restriction();
502
        $type->setRestriction($restriction);
503
        if ($node->hasAttribute("base")) {
504
            $restrictedType = $this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("base"));
505
            $restriction->setBase($restrictedType);
506
        } else {
507
            $addCallback = function ($restType) use ($restriction) {
508
                $restriction->setBase($restType);
509
            };
510
511
            foreach ($node->childNodes as $childNode) {
512
                switch ($childNode->localName) {
513
                    case 'simpleType':
514
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
515
                        break;
516
                }
517
            }
518
        }
519
        foreach ($node->childNodes as $childNode) {
520
            if (in_array($childNode->localName,
521
                [