Completed
Push — master ( 4c74f5...2b33f7 )
by Aurimas
04:08
created

PoweredByModifier   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 17
ccs 0
cts 8
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A modify() 0 4 1
1
<?php
2
3
namespace Thruster\Component\HttpServer\ResponseModifier;
4
5
use Psr\Http\Message\ResponseInterface;
6
use Thruster\Component\HttpServer\HttpServer;
7
use Thruster\Component\HttpServer\ResponseModifierInterface;
8
9
/**
10
 * Class PoweredByModifier
11
 *
12
 * @package Thruster\Component\HttpServer\ResponseModifier
13
 * @author  Aurimas Niekis <[email protected]>
14
 */
15
class PoweredByModifier implements ResponseModifierInterface
16
{
17
    /**
18
     * @var string
19
     */
20
    private $poweredBy;
21
22
    public function __construct(string $poweredBy)
23
    {
24
        $this->poweredBy = $poweredBy;
25
    }
26
27
    public function modify(ResponseInterface $response) : ResponseInterface
28
    {
29
        return $response->withHeader('X-Powered-By', $this->poweredBy);
30
    }
31
}
32