GetList::index()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
ccs 0
cts 5
cp 0
crap 2
1
<?php defined('BASEPATH') or exit('No direct script access allowed');
2
3
class GetList extends Auth_Controller {
4
	private $userID;
5
6
	public function __construct() {
7
		parent::__construct(FALSE);
8
9
		//CHECK: Should we limit internal AJAX requests?
10
		//$this->load->library('Limiter');
11
		//$this->load->library('form_validation');
12
13
		////1000 requests per hour to either AJAX request.
14
		//if($this->limiter->limit('tracker_general', 1000)) {
15
		//	$this->output->set_status_header('429', 'Rate limit reached'); //rate limited reached
16
17
		//	exit_ci();
18
		//}
19
20
		$this->userID = (int) $this->User->id;
21
	}
22
23
	public function index(string $category = 'all') : void {
24
		$data = $this->Tracker->list->get($this->userID, $category);
25
		$data = $this->_sanitize($data);
26
27
		$this->_render_json($data);
28
	}
29
30
	private function _sanitize(array $trackerData) : array {
31
		return $trackerData;
32
	}
33
}
34