Code Duplication    Length = 24-25 lines in 2 locations

application/models/Site_Model.php 2 locations

@@ 740-763 (lines=24) @@
737
		];
738
	}
739
740
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
741
		$titleData = [];
742
743
		$fullURL = $this->getFullTitleURL($title_url);
744
		$content = $this->get_content($fullURL);
745
746
		$data = $this->parseTitleDataDOM(
747
			$content,
748
			$title_url,
749
			"//h2[@class='aname']",
750
			"(//table[@id='listing']/tr)[last()]",
751
			"td[2]",
752
			"td[1]/a"
753
		);
754
		if($data) {
755
			$titleData['title'] = $data['nodes_title']->textContent;
756
757
			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
758
759
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
760
		}
761
762
		return (!empty($titleData) ? $titleData : NULL);
763
	}
764
}
765
766
class MangaStream extends Site_Model {
@@ 782-806 (lines=25) @@
779
		];
780
	}
781
782
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
783
		$titleData = [];
784
785
		$fullURL = $this->getFullTitleURL($title_url);
786
		$content = $this->get_content($fullURL);
787
788
		$data = $this->parseTitleDataDOM(
789
			$content,
790
			$title_url,
791
			"//div[contains(@class, 'content')]/div[1]/h1",
792
			"//div[contains(@class, 'content')]/div[1]/table/tr[2]",
793
			"td[2]",
794
			"td[1]/a",
795
			"<h1>Page Not Found</h1>"
796
		);
797
		if($data) {
798
			$titleData['title'] = $data['nodes_title']->textContent;
799
800
			$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
801
802
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
803
		}
804
805
		return (!empty($titleData) ? $titleData : NULL);
806
	}
807
}
808
809
class WebToons extends Site_Model {