| Conditions | 2 |
| Paths | 2 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 15 | public function create(bool $enableCache, string $cacheDir): ValidatorInterface |
||
| 16 | { |
||
| 17 | $validationBuilder = Validation::createValidatorBuilder(); |
||
| 18 | |||
| 19 | if (!$enableCache) { |
||
| 20 | return $validationBuilder |
||
| 21 | ->enableAnnotationMapping() |
||
| 22 | ->getValidator(); |
||
| 23 | } |
||
| 24 | |||
| 25 | $cache = new FilesystemCache($cacheDir . 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 |