Code Duplication    Length = 24-25 lines in 2 locations

application/models/Site_Model.php 2 locations

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