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

MerakiScans   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFullTitleURL() 0 3 1
A getChapterData() 0 8 3
A getTitleData() 0 4 1
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