Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Lines | 16 |
Ratio | 100 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php defined('BASEPATH') or exit('No direct script access allowed'); |
||
18 | View Code Duplication | public function index() : void { |
|
19 | if($this->ion_auth->logged_in()) { |
||
20 | if(!$this->limiter->limit('new_api_key', 10)) { |
||
21 | $api_key = $this->User->get_new_api_key(); |
||
22 | $json = ['api-key' => $api_key]; |
||
23 | |||
24 | $this->output |
||
25 | ->set_content_type('application/json') |
||
26 | ->set_output(json_encode($json)); |
||
27 | } else { |
||
28 | $this->output->set_status_header('429', 'Rate limit reached.'); |
||
29 | } |
||
30 | } else { |
||
31 | $this->output->set_status_header('400', 'Not logged in.'); |
||
32 | } |
||
33 | } |
||
34 | |||
52 |