Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
ApiController | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Engelsystem\Controllers\Api; |
6 | |
7 | use Engelsystem\Controllers\BaseController; |
8 | use Engelsystem\Http\Response; |
9 | |
10 | abstract class ApiController extends BaseController |
11 | { |
12 | public array $permissions = [ |
13 | 'api', |
14 | ]; |
15 | |
16 | public function __construct(protected Response $response) |
17 | { |
18 | $this->response = $this->response |
19 | ->withHeader('content-type', 'application/json') |
20 | // Using * here to "skip" all other headers on browser requests |
21 | ->withHeader('access-control-allow-origin', '*'); |
22 | } |
23 | } |