Code Duplication    Length = 24-25 lines in 2 locations

application/models/Site_Model.php 2 locations

@@ 657-680 (lines=24) @@
654
		];
655
	}
656
657
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
658
		$titleData = [];
659
660
		$fullURL = $this->getFullTitleURL($title_url);
661
		$content = $this->get_content($fullURL);
662
663
		$data = $this->parseTitleDataDOM(
664
			$content,
665
			$title_url,
666
			"//h2[@class='aname']",
667
			"(//table[@id='listing']/tr)[last()]",
668
			"td[2]",
669
			"td[1]/a"
670
		);
671
		if($data) {
672
			$titleData['title'] = $data['nodes_title']->textContent;
673
674
			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
675
676
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
677
		}
678
679
		return (!empty($titleData) ? $titleData : NULL);
680
	}
681
}
682
683
class MangaStream extends Site_Model {
@@ 699-723 (lines=25) @@
696
		];
697
	}
698
699
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
700
		$titleData = [];
701
702
		$fullURL = $this->getFullTitleURL($title_url);
703
		$content = $this->get_content($fullURL);
704
705
		$data = $this->parseTitleDataDOM(
706
			$content,
707
			$title_url,
708
			"//div[contains(@class, 'content')]/div[1]/h1",
709
			"//div[contains(@class, 'content')]/div[1]/table/tr[2]",
710
			"td[2]",
711
			"td[1]/a",
712
			"<h1>Page Not Found</h1>"
713
		);
714
		if($data) {
715
			$titleData['title'] = $data['nodes_title']->textContent;
716
717
			$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
718
719
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
720
		}
721
722
		return (!empty($titleData) ? $titleData : NULL);
723
	}
724
}
725
726
class WebToons extends Site_Model {