Code Duplication    Length = 25-26 lines in 2 locations

application/models/Site_Model.php 2 locations

@@ 497-521 (lines=25) @@
494
		];
495
	}
496
497
	public function getTitleData(string $title_url) {
498
		$titleData = [];
499
500
		$fullURL = $this->getFullTitleURL($title_url);
501
		$content = $this->get_content($fullURL);
502
503
		$data = $this->parseTitleDataDOM(
504
			$content,
505
			'MangaPanda',
506
			$title_url,
507
			"//h2[@class='aname']",
508
			"(//table[@id='listing']/tr)[last()]",
509
			"td[2]",
510
			"td[1]/a"
511
		);
512
		if($data) {
513
			$titleData['title'] = $data['nodes_title']->textContent;
514
515
			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
516
517
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
518
		}
519
520
		return (!empty($titleData) ? $titleData : NULL);
521
	}
522
}
523
524
class MangaStream extends Site_Model {
@@ 540-565 (lines=26) @@
537
		];
538
	}
539
540
	public function getTitleData(string $title_url) {
541
		$titleData = [];
542
543
		$fullURL = $this->getFullTitleURL($title_url);
544
		$content = $this->get_content($fullURL);
545
546
		$data = $this->parseTitleDataDOM(
547
			$content,
548
			'MangaStream',
549
			$title_url,
550
			"//div[contains(@class, 'content')]/div[1]/h1",
551
			"//div[contains(@class, 'content')]/div[1]/table/tr[2]",
552
			"td[2]",
553
			"td[1]/a",
554
			"<h1>Page Not Found</h1>"
555
		);
556
		if($data) {
557
			$titleData['title'] = $data['nodes_title']->textContent;
558
559
			$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
560
561
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
562
		}
563
564
		return (!empty($titleData) ? $titleData : NULL);
565
	}
566
}
567
568
class WebToons extends Site_Model {