ValidatorExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 2 Features 0
Metric Value
wmc 1
c 3
b 2
f 0
lcom 0
cbo 3
dl 0
loc 21
ccs 12
cts 12
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadConfiguration() 0 16 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