ResponseHeadersAlter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
c 1
b 0
f 0
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A alter() 0 13 2
1
<?php
2
3
/**
4
 * For the full copyright and license information, please view
5
 * the LICENSE file that was distributed with this source code.
6
 */
7
8
declare(strict_types=1);
9
10
namespace loophp\GoUnflocYourselfBundle\Service;
11
12
use Symfony\Component\HttpFoundation\Response;
13
14
final class ResponseHeadersAlter implements ResponseAlterInterface
15
{
16 1
    public function alter(Response $response): Response
17
    {
18 1
        if (false === $response->headers->has('Permissions-Policy')) {
19
            $response
20 1
                ->headers
21 1
                ->add(
22
                    [
23 1
                        'Permissions-Policy' => 'interest-cohort=()',
24
                    ]
25
                );
26
        }
27
28 1
        return $response;
29
    }
30
}
31