Response   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 18
ccs 6
cts 6
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Router\Entities;
6
7
use Stringable;
8
9
class Response implements Stringable
10
{
11
    /**
12
     * @param list<string> $headers
13
     */
14 8
    public function __construct(
15
        private string $content,
16
        private array $headers = [],
17
    ) {
18 8
    }
19
20 8
    public function __toString(): string
21
    {
22 8
        foreach ($this->headers as $header) {
23 5
            header($header);
24
        }
25
26 8
        return $this->content;
27
    }
28
}
29