Code Duplication    Length = 7-9 lines in 2 locations

api/src/Storage/Merge.php 2 locations

@@ 592-598 (lines=7) @@
589
590
	protected function apply_styles (&$content, $mimetype, $mso_application_progid=null)
591
	{
592
		if (!isset($mso_application_progid))
593
		{
594
			$matches = null;
595
			$mso_application_progid = $mimetype == 'application/xml' &&
596
				preg_match('/'.preg_quote('<?mso-application progid="').'([^"]+)'.preg_quote('"?>').'/',substr($content,0,200),$matches) ?
597
					$matches[1] : '';
598
		}
599
		// Tags we can replace with the target document's version
600
		$replace_tags = array();
601
		switch($mimetype.$mso_application_progid)
@@ 700-708 (lines=9) @@
697
	public function &merge_string($_content,$ids,&$err,$mimetype,array $fix=null,$charset=null)
698
	{
699
		$matches = null;
700
		if ($mimetype == 'application/xml' &&
701
			preg_match('/'.preg_quote('<?mso-application progid="').'([^"]+)'.preg_quote('"?>').'/',substr($_content,0,200),$matches))
702
		{
703
			$mso_application_progid = $matches[1];
704
		}
705
		else
706
		{
707
			$mso_application_progid = '';
708
		}
709
		// alternative syntax using double curly brackets (eg. {{cat_id}} instead $$cat_id$$),
710
		// agressivly removing all xml-tags eg. Word adds within placeholders
711
		$content = preg_replace_callback('/{{[^}]+}}/i',create_function('$p','return \'$$\'.strip_tags(substr($p[0],2,-2)).\'$$\';'),$_content);