Http   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 81.82%

Importance

Changes 6
Bugs 1 Features 2
Metric Value
wmc 3
c 6
b 1
f 2
lcom 1
cbo 4
dl 0
loc 21
ccs 9
cts 11
cp 0.8182
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A initiate() 0 9 1
A sendDebugIds() 0 6 2
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