Code Duplication    Length = 11-11 lines in 2 locations

src/PfPageparser.php 2 locations

@@ 198-208 (lines=11) @@
195
        foreach ($this->chunks as $id => $chunk) {
196
            //
197
            $keep_chunk = true;
198
            if (!empty($pattern_keep)) {
199
                $pattern_found = false;
200
                foreach ($pattern_keep as $pattern) {
201
                    if ($is_regex) {
202
                        $pattern_found = ($pattern_found or preg_match($pattern, $chunk, $matches));
203
                    } else {
204
                        $pattern_found = ($pattern_found or strpos($chunk, $pattern) !== false);
205
                    }
206
                }
207
                $keep_chunk = ($keep_chunk and $pattern_found);
208
            }
209
            if (!empty($pattern_remove)) {
210
                $pattern_found = false;
211
                foreach ($pattern_remove as $pattern) {
@@ 209-219 (lines=11) @@
206
                }
207
                $keep_chunk = ($keep_chunk and $pattern_found);
208
            }
209
            if (!empty($pattern_remove)) {
210
                $pattern_found = false;
211
                foreach ($pattern_remove as $pattern) {
212
                    if ($is_regex) {
213
                        $pattern_found = ($pattern_found or preg_match($pattern, $chunk, $matches));
214
                    } else {
215
                        $pattern_found = ($pattern_found or strpos($chunk, $pattern) !== false);
216
                    }
217
                }
218
                $keep_chunk = ($keep_chunk and !$pattern_found);
219
            }
220
            if (!$keep_chunk) {
221
                unset($this->chunks[$id]);
222
            }