Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2.351 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
15 | 1 | public function create(bool $enableCache, \SplFileInfo $cacheDir): ValidatorInterface |
|
16 | { |
||
17 | 1 | $validationBuilder = Validation::createValidatorBuilder(); |
|
18 | |||
19 | 1 | if (!$enableCache) { |
|
20 | return $validationBuilder |
||
21 | 1 | ->enableAnnotationMapping() |
|
22 | 1 | ->getValidator(); |
|
23 | } |
||
24 | |||
25 | $cache = new FilesystemCache($cacheDir->getPathname() . DIRECTORY_SEPARATOR . self::VALIDATOR_CACHE_DIRECTORY); |
||
26 | |||
27 | $annotationReader = new CachedReader(new AnnotationReader(), $cache); |
||
28 | |||
29 | return $validationBuilder |
||
30 | ->enableAnnotationMapping($annotationReader) |
||
31 | ->getValidator(); |
||
32 | } |
||
34 |