TwigSyntax::validatedBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
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