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