Code Duplication    Length = 24-25 lines in 2 locations

application/models/Site_Model.php 2 locations

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