Header::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 3
rs 10
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
}