Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
12 / 12
ForbiddenResponse
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
12 / 12
 __construct
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
12 / 12
1<?php
2
3namespace Miniframe\Response;
4
5use Miniframe\Core\Request;
6use Miniframe\Core\Response;
7
8class ForbiddenResponse extends Response
9{
10    /**
11     * Initializes a basic 403 Forbidden response
12     */
13    public function __construct()
14    {
15        $html = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' . PHP_EOL
16            . '<html><head>' . PHP_EOL
17            . '<title>403 Forbidden</title>' . PHP_EOL
18            . '</head><body>' . PHP_EOL
19            . '<h1>Forbidden</h1>' . PHP_EOL
20            . '<p>You don\'t have permission to access this resource.</p>' . PHP_EOL
21            . '<hr>' . PHP_EOL
22            . (Request::getActual()->getServer('SERVER_SIGNATURE') ?? '') . PHP_EOL
23            . '</body></html>';
24
25        parent::__construct($html, 1);
26        $this->setResponseCode(403);
27    }
28}