Code Duplication    Length = 25-26 lines in 2 locations

application/models/Site_Model.php 2 locations

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