TwigSyntax   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 20
ccs 7
cts 7
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A validatedBy() 0 4 1
A __construct() 0 8 3
1
<?php
2
namespace Boekkooi\Bundle\TwigJackBundle\Validator\Constraint;
3
4
use Symfony\Component\Validator\Constraint;
5
use Symfony\Component\Validator\Exception\InvalidOptionsException;
6
7
/**
8
 * @author Warnar Boekkooi <[email protected]>
9
 */
10
class TwigSyntax extends Constraint
11
{
12
    public $message = 'This value is not a valid twig template.';
13
    public $parse = true;
14
    public $environment = null;
15
16 6
    public function __construct($options = null)
17
    {
18 6
        parent::__construct($options);
19
20 4
        if ($this->environment !== null && !$this->environment instanceof \Twig_Environment) {
21 1
            throw new InvalidOptionsException(sprintf('Option "environment" must be null or a Twig_Environment instance for constraint %s', __CLASS__), array('environment'));
22
        }
23 3
    }
24
25 1
    public function validatedBy()
26
    {
27 1
        return 'TwigSyntaxValidator';
28
    }
29
}
30