Http::sendDebugIds()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.256

Importance

Changes 4
Bugs 1 Features 1
Metric Value
c 4
b 1
f 1
dl 0
loc 6
ccs 3
cts 5
cp 0.6
rs 9.4286
cc 2
eloc 3
nc 2
nop 0
crap 2.256
1
<?php
2
3
namespace Ndrx\Profiler\Context;
4
5
use Ndrx\Profiler\Process;
6
7
/**
8
 * Created by PhpStorm.
9
 * User: arnaud
10
 * Date: 01/11/15
11
 * Time: 16:38
12
 */
13
class Http extends Context
14
{
15
    const HEADER_PROCESS = 'Process-Id';
16
17 4
    public function initiate()
18
    {
19 4
        parent::initiate();
20
21 4
        $processId = $this->request->headers->get(self::HEADER_PROCESS, null);
22
23 4
        $this->process = Process::build($processId);
24 4
        $this->process->setContext($this);
25 4
    }
26
27 2
    public function sendDebugIds()
28
    {
29 2
        if (!headers_sent()) {
30
            header(self::HEADER_PROCESS . ': ' . $this->process->getId());
31
        }
32 2
    }
33
}
34