Code Duplication    Length = 15-16 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 423-437 (lines=15) @@
420
421
    private function loadList(SimpleType $type, DOMElement $node)
422
    {
423
        if ($node->hasAttribute("itemType")) {
424
            $type->setList($this->findSomething('findType', $type->getSchema(), $node, $node->getAttribute("itemType")));
425
        } else {
426
            $addCallback = function ($list) use ($type) {
427
                $type->setList($list);
428
            };
429
430
            foreach ($node->childNodes as $childNode) {
431
                switch ($childNode->localName) {
432
                    case 'simpleType':
433
                        call_user_func($this->loadSimpleType($type->getSchema(), $childNode, $addCallback));
434
                        break;
435
                }
436
            }
437
        }
438
    }
439
440
    private function loadUnion(SimpleType $type, DOMElement $node)
@@ 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
                [