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

Context   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 5
c 2
b 0
f 0
lcom 0
cbo 0
dl 0
loc 27
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 3
A getName() 0 4 1
A getValue() 0 4 1
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\Annotation;
15
16
use Doctrine\Common\Annotations\Annotation;
17
18
/**
19
 * @Annotation
20
 * @Target("METHOD")
21
 */
22
class Context
23
{
24
    protected $name;
25
26
    protected $value;
27
28
    public function __construct($options)
29
    {
30
        foreach ($options as $key => $value) {
31
            if (!property_exists($this, $key)) {
32
                throw new \InvalidArgumentException(sprintf('Property "%s" does not exist', $key));
33
            }
34
35
            $this->$key = $value;
36
        }
37
    }
38
39
    public function getName()
40
    {
41
        return $this->name;
42
    }
43
44
    public function getValue()
45
    {
46
        return $this->value;
47
    }
48
}
49