Code Duplication    Length = 17-17 lines in 2 locations

src/StreamFilters/InvariantFilter.php 2 locations

@@ 109-125 (lines=17) @@
106
            );
107
108
            // Determine if we need the __set method to be injected
109
            if ($structureDefinition->getFunctionDefinitions()->entryExists('__set')) {
110
                // Get the code for our __set() method
111
                $setCode = $this->generateSetCode($structureDefinition->hasParents(), true);
112
                $chunk = str_replace(
113
                    Placeholders::METHOD_INJECT . '__set' . Placeholders::PLACEHOLDER_CLOSE,
114
                    $setCode,
115
                    $chunk
116
                );
117
118
            } else {
119
                $setCode = $this->generateSetCode($structureDefinition->hasParents());
120
                $chunk = str_replace(
121
                    $functionHook,
122
                    $functionHook . $setCode,
123
                    $chunk
124
                );
125
            }
126
127
            // Determine if we need the __get method to be injected
128
            if ($structureDefinition->getFunctionDefinitions()->entryExists('__get')) {
@@ 128-144 (lines=17) @@
125
            }
126
127
            // Determine if we need the __get method to be injected
128
            if ($structureDefinition->getFunctionDefinitions()->entryExists('__get')) {
129
                // Get the code for our __set() method
130
                $getCode = $this->generateGetCode($structureDefinition->hasParents(), true);
131
                $chunk = str_replace(
132
                    Placeholders::METHOD_INJECT . '__get' . Placeholders::PLACEHOLDER_CLOSE,
133
                    $getCode,
134
                    $chunk
135
                );
136
137
            } else {
138
                $getCode = $this->generateGetCode($structureDefinition->hasParents());
139
                $chunk = str_replace(
140
                    $functionHook,
141
                    $functionHook . $getCode,
142
                    $chunk
143
                );
144
            }
145
        }
146
147
        // We need the code to call the invariant