Completed
Push — master ( 530ce9...1b2ae5 )
by Paweł
23:42 queued 20:31
created

ContextDataCollector::collect()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
1
<?php
2
3
/**
4
 * This file is part of the Superdesk Web Publisher Template Engine Bundle.
5
 *
6
 * Copyright 2015 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2015 Sourcefabric z.ú.
12
 * @license http://www.superdesk.org/license
13
 */
14
namespace SWP\Bundle\TemplateEngineBundle\DataCollector;
15
16
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
17
use Symfony\Component\HttpFoundation\Request;
18
use Symfony\Component\HttpFoundation\Response;
19
20
class ContextDataCollector extends DataCollector
21
{
22
    protected $context;
23
24
    public function __construct($context)
25
    {
26
        $this->context = $context;
27
    }
28
29
    public function collect(Request $request, Response $response, \Exception $exception = null)
30
    {
31
        $this->data = array(
32
            'context' => $this->context,
33
        );
34
    }
35
36
    public function getContext()
37
    {
38
        return $this->data['context'];
39
    }
40
41
    public function getName()
42
    {
43
        return 'context_collector';
44
    }
45
}
46