Code Duplication    Length = 5-6 lines in 4 locations

thirdparty/html5lib/HTML5/TreeBuilder.php 4 locations

@@ 315-320 (lines=6) @@
312
            } else {
313
                do {
314
                    if ($system) {
315
                        foreach ($publicStartsWithAndSystemForQuirks as $x) {
316
                            if (strncmp($public, $x, strlen($x)) === 0) {
317
                                $this->quirks_mode = self::QUIRKS_MODE;
318
                                break;
319
                            }
320
                        }
321
                        if (!is_null($this->quirks_mode)) break;
322
                        foreach ($publicStartsWithAndSystemForLimitedQuirks as $x) {
323
                            if (strncmp($public, $x, strlen($x)) === 0) {
@@ 322-327 (lines=6) @@
319
                            }
320
                        }
321
                        if (!is_null($this->quirks_mode)) break;
322
                        foreach ($publicStartsWithAndSystemForLimitedQuirks as $x) {
323
                            if (strncmp($public, $x, strlen($x)) === 0) {
324
                                $this->quirks_mode = self::LIMITED_QUIRKS_MODE;
325
                                break;
326
                            }
327
                        }
328
                        if (!is_null($this->quirks_mode)) break;
329
                    }
330
                    foreach ($publicSetToForQuirks as $x) {
@@ 337-341 (lines=5) @@
334
                        }
335
                    }
336
                    if (!is_null($this->quirks_mode)) break;
337
                    foreach ($publicStartsWithForLimitedQuirks as $x) {
338
                        if (strncmp($public, $x, strlen($x)) === 0) {
339
                            $this->quirks_mode = self::LIMITED_QUIRKS_MODE;
340
                        }
341
                    }
342
                    if (!is_null($this->quirks_mode)) break;
343
                    if ($system === "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd") {
344
                        $this->quirks_mode = self::QUIRKS_MODE;
@@ 347-352 (lines=6) @@
344
                        $this->quirks_mode = self::QUIRKS_MODE;
345
                        break;
346
                    }
347
                    foreach ($publicStartsWithForQuirks as $x) {
348
                        if (strncmp($public, $x, strlen($x)) === 0) {
349
                            $this->quirks_mode = self::QUIRKS_MODE;
350
                            break;
351
                        }
352
                    }
353
                    if (is_null($this->quirks_mode)) {
354
                        $this->quirks_mode = self::NO_QUIRKS;
355
                    }