Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
ApiController
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Controllers\Api;
6
7use Engelsystem\Controllers\BaseController;
8use Engelsystem\Http\Response;
9
10abstract 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}