Passed
Push — master ( 4f415b...b6b0b7 )
by Gabriel
03:01
created

HasHeadersTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 42.86%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 3
eloc 5
dl 0
loc 31
rs 10
c 2
b 0
f 2
ccs 3
cts 7
cp 0.4286

3 Methods

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