Passed
Pull Request — main (#6)
by Chema
02:34 queued 11s
created

header()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 7
c 0
b 0
f 0
nc 2
nop 3
dl 0
loc 13
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Gacela\Router;
6
7
use function is_array;
8
9
function header(string $header, bool $replace = true, int $responseCode = 0): void
10
{
11
    /** @var list<array{header: string, replace: boolean, response_code: int}> | null $testHeaders */
12
    global $testHeaders;
13
14
    if (!is_array($testHeaders)) {
1 ignored issue
show
introduced by
The condition is_array($testHeaders) is always false.
Loading history...
15
        $testHeaders = [];
16
    }
17
18
    $testHeaders[] = [
19
        'header' => $header,
20
        'replace' => $replace,
21
        'response_code' => $responseCode,
22
    ];
23
}
24