Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
6 / 6
ValidatorBuilder
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
6 / 6
 getValidator(Reader $reader = null)
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
6 / 6
<?php
/**
 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 */
namespace Team3\PayU\ValidatorBuilder;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Validator\Validation;
use Symfony\Component\Validator\Validator\ValidatorInterface;
/**
 * {@inheritdoc}
 *
 * Class ValidatorBuilder
 * @package Team3\PayU\ValidatorBuilder
 */
class ValidatorBuilder implements ValidatorBuilderInterface
{
    /**
     * @param Reader $reader
     *
     * @return ValidatorInterface
     */
    public function getValidator(Reader $reader = null)
    {
        if (null === $reader) {
            $reader = new AnnotationReader();
        }
        return Validation::createValidatorBuilder()
            ->enableAnnotationMapping($reader)
            ->getValidator();
    }
}