Header   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 6
c 3
b 0
f 0
dl 0
loc 13
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A send() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Furious\HttpRunner;
6
7
final class Header
8
{
9
    public function __construct(string $name, string $value, int $code = null, bool $replace = true)
10
    {
11
        $this->send($name, $value, $code, $replace);
12
    }
13
14
    public function send(string $name, string $value, int $code = null, bool $replace = true): void
15
    {
16
        if (null === $code) {
17
            header($name . ': ' . $value, $replace);
18
        } else {
19
            header($name . ': ' . $value, $replace, $code);
20
        }
21
    }
22
}