Code Duplication    Length = 12-12 lines in 5 locations

src/wp-includes/SimplePie/Misc.php 5 locations

@@ 2052-2063 (lines=12) @@
2049
			$encoding[] = 'UTF-8';
2050
		}
2051
		// UTF-32 Big Endian Without BOM
2052
		elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
2053
		{
2054
			if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
2055
			{
2056
				$parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8')));
2057
				if ($parser->parse())
2058
				{
2059
					$encoding[] = $parser->encoding;
2060
				}
2061
			}
2062
			$encoding[] = 'UTF-32BE';
2063
		}
2064
		// UTF-32 Little Endian Without BOM
2065
		elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
2066
		{
@@ 2065-2076 (lines=12) @@
2062
			$encoding[] = 'UTF-32BE';
2063
		}
2064
		// UTF-32 Little Endian Without BOM
2065
		elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
2066
		{
2067
			if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
2068
			{
2069
				$parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8')));
2070
				if ($parser->parse())
2071
				{
2072
					$encoding[] = $parser->encoding;
2073
				}
2074
			}
2075
			$encoding[] = 'UTF-32LE';
2076
		}
2077
		// UTF-16 Big Endian Without BOM
2078
		elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
2079
		{
@@ 2078-2089 (lines=12) @@
2075
			$encoding[] = 'UTF-32LE';
2076
		}
2077
		// UTF-16 Big Endian Without BOM
2078
		elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
2079
		{
2080
			if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
2081
			{
2082
				$parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8')));
2083
				if ($parser->parse())
2084
				{
2085
					$encoding[] = $parser->encoding;
2086
				}
2087
			}
2088
			$encoding[] = 'UTF-16BE';
2089
		}
2090
		// UTF-16 Little Endian Without BOM
2091
		elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
2092
		{
@@ 2091-2102 (lines=12) @@
2088
			$encoding[] = 'UTF-16BE';
2089
		}
2090
		// UTF-16 Little Endian Without BOM
2091
		elseif (substr($data, 0, 10) === "\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C\x00")
2092
		{
2093
			if ($pos = strpos($data, "\x3F\x00\x3E\x00"))
2094
			{
2095
				$parser = $registry->create('XML_Declaration_Parser', array(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16LE', 'UTF-8')));
2096
				if ($parser->parse())
2097
				{
2098
					$encoding[] = $parser->encoding;
2099
				}
2100
			}
2101
			$encoding[] = 'UTF-16LE';
2102
		}
2103
		// US-ASCII (or superset)
2104
		elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
2105
		{
@@ 2104-2115 (lines=12) @@
2101
			$encoding[] = 'UTF-16LE';
2102
		}
2103
		// US-ASCII (or superset)
2104
		elseif (substr($data, 0, 5) === "\x3C\x3F\x78\x6D\x6C")
2105
		{
2106
			if ($pos = strpos($data, "\x3F\x3E"))
2107
			{
2108
				$parser = $registry->create('XML_Declaration_Parser', array(substr($data, 5, $pos - 5)));
2109
				if ($parser->parse())
2110
				{
2111
					$encoding[] = $parser->encoding;
2112
				}
2113
			}
2114
			$encoding[] = 'UTF-8';
2115
		}
2116
		// Fallback to UTF-8
2117
		else
2118
		{