Code Duplication    Length = 25-26 lines in 2 locations

application/models/Site_Model.php 2 locations

@@ 485-509 (lines=25) @@
482
		return $success;
483
	}
484
485
	public function getTitleData(string $title_url) {
486
		$titleData = [];
487
488
		$fullURL = $this->getFullTitleURL($title_url);
489
		$content = $this->get_content($fullURL);
490
491
		$data = $this->parseTitleDataDOM(
492
			$content,
493
			'MangaPanda',
494
			$title_url,
495
			"//h2[@class='aname']",
496
			"(//table[@id='listing']/tr)[last()]",
497
			"td[2]",
498
			"td[1]/a"
499
		);
500
		if($data) {
501
			$titleData['title'] = $data['nodes_title']->textContent;
502
503
			$titleData['latest_chapter'] = preg_replace('/^.*\/([0-9]+)$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
504
505
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
506
		}
507
508
		return (!empty($titleData) ? $titleData : NULL);
509
	}
510
}
511
512
class MangaStream extends Site_Model {
@@ 535-560 (lines=26) @@
532
		];
533
	}
534
535
	public function getTitleData(string $title_url) {
536
		$titleData = [];
537
538
		$fullURL = $this->getFullTitleURL($title_url);
539
		$content = $this->get_content($fullURL);
540
541
		$data = $this->parseTitleDataDOM(
542
			$content,
543
			'MangaStream',
544
			$title_url,
545
			"//div[contains(@class, 'content')]/div[1]/h1",
546
			"//div[contains(@class, 'content')]/div[1]/table/tr[2]",
547
			"td[2]",
548
			"td[1]/a",
549
			"<h1>Page Not Found</h1>"
550
		);
551
		if($data) {
552
			$titleData['title'] = $data['nodes_title']->textContent;
553
554
			$titleData['latest_chapter'] = preg_replace('/^.*\/(.*?\/[0-9]+)\/[0-9]+$/', '$1', (string) $data['nodes_chapter']->getAttribute('href'));
555
556
			$titleData['last_updated'] =  date("Y-m-d H:i:s", strtotime((string) $data['nodes_latest']->nodeValue));
557
		}
558
559
		return (!empty($titleData) ? $titleData : NULL);
560
	}
561
}
562
563
class WebToons extends Site_Model {