Code Duplication    Length = 24-25 lines in 2 locations

application/models/Site_Model.php 2 locations

@@ 761-784 (lines=24) @@
758
		];
759
	}
760
761
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
762
		$titleData = [];
763
764
		$fullURL = $this->getFullTitleURL($title_url);
765
		$content = $this->get_content($fullURL);
766
767
		$data = $this->parseTitleDataDOM(
768
			$content,
769
			$title_url,
770
			"//h2[@class='aname']",
771
			"(//table[@id='listing']/tr)[last()]",
772
			"td[2]",
773
			"td[1]/a"
774
		);
775
		if($data) {
776
			$titleData['title'] = $data['nodes_title']->textContent;
777
778
			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
779
780
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
781
		}
782
783
		return (!empty($titleData) ? $titleData : NULL);
784
	}
785
}
786
787
class MangaStream extends Site_Model {
@@ 803-827 (lines=25) @@
800
		];
801
	}
802
803
	public function getTitleData(string $title_url, bool $firstGet = FALSE) {
804
		$titleData = [];
805
806
		$fullURL = $this->getFullTitleURL($title_url);
807
		$content = $this->get_content($fullURL);
808
809
		$data = $this->parseTitleDataDOM(
810
			$content,
811
			$title_url,
812
			"//div[contains(@class, 'content')]/div[1]/h1",
813
			"//div[contains(@class, 'content')]/div[1]/table/tr[2]",
814
			"td[2]",
815
			"td[1]/a",
816
			"<h1>Page Not Found</h1>"
817
		);
818
		if($data) {
819
			$titleData['title'] = $data['nodes_title']->textContent;
820
821
			$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
822
823
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
824
		}
825
826
		return (!empty($titleData) ? $titleData : NULL);
827
	}
828
}
829
830
class WebToons extends Site_Model {