Passed
Push — master ( 877f87...c048a4 )
by Gabriel
11:44
created

HasHeadersTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 5
c 0
b 0
f 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHeaders() 0 3 1
A addP3PHeader() 0 8 1
A initHeaders() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Nip\Controllers\Response\ResponsePayload\Traits;
6
7
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
8
9
/**
10
 * Trait HasHeadersTrait
11
 * @package Nip\Controllers\Response\ResponsePayload
12
 */
13
trait HasHeadersTrait
14
{
15
    /**
16
     * @var ResponseHeaderBag
17
     */
18
    public $headers;
19
20
    protected function initHeaders()
21
    {
22
        $this->headers = new ResponseHeaderBag();
23
    }
24
25
    /**
26
     * @return ResponseHeaderBag
27
     */
28
    public function getHeaders()
29
    {
30
        return $this->headers;
31
    }
32
33
    /**
34
     * @param string $value
35
     */
36
    public function addP3PHeader($value = 'CP="CAO PSA OUR"')
37
    {
38
        // FIX FOR IE SESSION COOKIE
39
        // CAO IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT
40
        // ALL ADM DEV PSAi COM OUR OTRo STP IND ONL
41
//        header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
42
43
        $this->headers->set('P3P', $value);
44
    }
45
}
46