ValidatorExtension::loadConfiguration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 3
Bugs 2 Features 0
Metric Value
c 3
b 2
f 0
dl 0
loc 16
ccs 12
cts 12
cp 1
rs 9.4286
cc 1
eloc 11
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of Symnedi.
5
 * Copyright (c) 2014 Tomas Votruba (http://tomasvotruba.cz)
6
 */
7
8
namespace Symnedi\Validator\DI;
9
10
use Nette\DI\CompilerExtension;
11
use Symfony\Component\Validator\Validator;
12
use Symfony\Component\Validator\Validator\RecursiveValidator;
13
use Symfony\Component\Validator\ValidatorBuilder;
14
use Symnedi\Validator\Caching\Cache;
15
16
17
class ValidatorExtension extends CompilerExtension
18
{
19
20 1
	public function loadConfiguration()
21
	{
22 1
		$builder = $this->getContainerBuilder();
23
24 1
		$builder->addDefinition($this->prefix('cache'))
25 1
			->setClass(Cache::class);
26
27 1
		$builder->addDefinition($this->prefix('validatorBuilder'))
28 1
			->setClass(ValidatorBuilder::class)
29 1
			->addSetup('enableAnnotationMapping')
30 1
			->addSetup('setMetadataCache');
31
32 1
		$builder->addDefinition($this->prefix('validator'))
33 1
			->setClass(RecursiveValidator::class)
34 1
			->setFactory(['@' . $this->prefix('validatorBuilder'), 'getValidator']);
35 1
	}
36
37
}
38