ResponseHeadersAlter::alter()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 13
ccs 6
cts 6
cp 1
rs 10
cc 2
nc 2
nop 1
crap 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