Completed
Push — master ( 073ade...95ac21 )
by Angus
02:59
created

MerakiScans::getTitleData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1); defined('BASEPATH') OR exit('No direct script access allowed');
2
3
class MerakiScans extends Base_Site_Model {
4
	public $titleFormat   = '/^[a-z0-9_-]+$/';
5
	public $chapterFormat = '/^en\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+(?:\/[0-9]+)?)?)?$/';
6
7
	public function getFullTitleURL(string $title_url) : string {
8
		return "http://www.merakiscans.com/reader/series/{$title_url}";
9
	}
10
11
	public function getChapterData(string $title_url, string $chapter) : array {
12
		//LANG/VOLUME/CHAPTER/CHAPTER_EXTRA(/page/)
13
		$chapter_parts = explode('/', $chapter);
14
		return [
15
			'url'    => "http://www.merakiscans.com/reader/read/{$title_url}/{$chapter}/",
16
			'number' => ($chapter_parts[1] !== '0' ? "v{$chapter_parts[1]}/" : '') . "c{$chapter_parts[2]}" . (isset($chapter_parts[3]) ? ".{$chapter_parts[3]}" : '')/*)*/
17
		];
18
	}
19
20
	public function getTitleData(string $title_url, bool $firstGet = FALSE) : ?array {
21
		$fullURL = $this->getFullTitleURL($title_url);
22
		return $this->parseFoolSlide($fullURL, $title_url);
23
	}
24
}
25