Code Duplication    Length = 34-35 lines in 2 locations

src/SchemaReader.php 2 locations

@@ 141-174 (lines=34) @@
138
    /**
139
     * @param int|null $max
140
     */
141
    private function loadSequenceChildNode(
142
        ElementContainer $elementContainer,
143
        DOMElement $node,
144
        DOMElement $childNode,
145
        $max
146
    ) {
147
        switch ($childNode->localName) {
148
            case 'sequence':
149
            case 'choice':
150
            case 'all':
151
                $this->loadSequence(
152
                    $elementContainer,
153
                    $childNode,
154
                    $max
155
                );
156
                break;
157
            case 'element':
158
                $this->loadSequenceChildNodeLoadElement(
159
                    $elementContainer,
160
                    $node,
161
                    $childNode,
162
                    $max
163
                );
164
                break;
165
            case 'group':
166
                $this->addGroupAsElement(
167
                    $elementContainer->getSchema(),
168
                    $node,
169
                    $childNode,
170
                    $elementContainer
171
                );
172
                break;
173
        }
174
    }
175
176
    /**
177
     * @param int|null $max
@@ 515-549 (lines=35) @@
512
    ) {
513
        static::againstDOMNodeList(
514
            $node,
515
            function (
516
                DOMElement $node,
517
                DOMElement $childNode
518
            ) use (
519
                $type
520
            ) {
521
                switch ($childNode->localName) {
522
                    case 'sequence':
523
                    case 'choice':
524
                    case 'all':
525
                        if ($type instanceof ElementContainer) {
526
                            $this->loadSequence(
527
                                $type,
528
                                $childNode
529
                            );
530
                        }
531
                        break;
532
                    case 'attribute':
533
                        $this->addAttributeFromAttributeOrRef(
534
                            $type,
535
                            $childNode,
536
                            $type->getSchema(),
537
                            $node
538
                        );
539
                        break;
540
                    case 'attributeGroup':
541
                        $this->findSomethingLikeAttributeGroup(
542
                            $type->getSchema(),
543
                            $node,
544
                            $childNode,
545
                            $type
546
                        );
547
                        break;
548
                }
549
            }
550
        );
551
    }
552