TitleHistory   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A index() 0 22 4
1
<?php defined('BASEPATH') OR exit('No direct script access allowed');
2
3
class TitleHistory extends Auth_Controller {
4
	public function __construct() {
5
		parent::__construct();
6
	}
7
8
	/**
9
	 * @param int $titleID
10
	 * @param int $page
11
	 */
12
	public function index(int $titleID, int $page = 1) : void {
13
		$this->header_data['title'] = "Title History";
14
		$this->header_data['page']  = "history";
15
16
		//CHECK: Should we only allow people to see history for series they are tracking?
17
		$historyData = $this->History->getTitleHistory((int) $titleID, $page);
18
19
		if(!empty($historyData['title'])) {
20
			$this->body_data['title']       = $historyData['title'];
21
			$this->body_data['historyData'] = $historyData['rows'];
22
			$this->body_data['currentPage'] = $page;
23
			$this->body_data['totalPages']  = $historyData['totalPages'];
24
			$this->body_data['titleID']     = (int) $titleID;
25
26
			if($page > $this->body_data['totalPages'] && $page > 1) redirect("/history/{$titleID}/1");
27
28
			$this->_render_page("TitleHistory");
29
30
		} else {
31
			show_404();
32
		}
33
	}
34
}
35