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
@@ 504-538 (lines=35) @@
501
    ) {
502
        static::againstDOMNodeList(
503
            $node,
504
            function (
505
                DOMElement $node,
506
                DOMElement $childNode
507
            ) use (
508
                $type
509
            ) {
510
                switch ($childNode->localName) {
511
                    case 'sequence':
512
                    case 'choice':
513
                    case 'all':
514
                        if ($type instanceof ElementContainer) {
515
                            $this->loadSequence(
516
                                $type,
517
                                $childNode
518
                            );
519
                        }
520
                        break;
521
                    case 'attribute':
522
                        $this->addAttributeFromAttributeOrRef(
523
                            $type,
524
                            $childNode,
525
                            $type->getSchema(),
526
                            $node
527
                        );
528
                        break;
529
                    case 'attributeGroup':
530
                        $this->findSomethingLikeAttributeGroup(
531
                            $type->getSchema(),
532
                            $node,
533
                            $childNode,
534
                            $type
535
                        );
536
                        break;
537
                }
538
            }
539
        );
540
    }
541