Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#536)
by
unknown
19:46
created

ValidatorFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Validator;
6
7
use Overblog\GraphQLBundle\Validator\Mapping\MetadataFactory;
8
use Symfony\Component\Validator\ConstraintValidatorFactoryInterface;
9
use Symfony\Component\Validator\Validation;
10
use Symfony\Component\Validator\Validator\ValidatorInterface;
11
use Symfony\Contracts\Translation\TranslatorInterface;
12
13
/**
14
 * ValidatorFactory
15
 *
16
 * @author Timur Murtukov <[email protected]>
17
 */
18
class ValidatorFactory
19
{
20
    private $defaultValidator;
21
    private $defaultTranslator;
22
    private $constraintValidatorFactory;
23
24 129
    public function __construct(?ValidatorInterface $validator, ConstraintValidatorFactoryInterface $constraintValidatorFactory, ?TranslatorInterface $translator)
25
    {
26 129
        $this->defaultValidator = $validator;
27 129
        $this->defaultTranslator = $translator;
28 129
        $this->constraintValidatorFactory = $constraintValidatorFactory;
29 129
    }
30
31 8
    public function createValidator(MetadataFactory $metadataFactory): ValidatorInterface
32
    {
33 8
        $builder = Validation::createValidatorBuilder()
34 8
            ->setMetadataFactory($metadataFactory)
35 8
            ->setConstraintValidatorFactory($this->constraintValidatorFactory)
36
        ;
37
38 8
        if (null !== $this->defaultTranslator) {
39
            $builder
40
                ->setTranslator($this->defaultTranslator)
41
                ->setTranslationDomain('validators');
42
        }
43
44 8
        return $builder->getValidator();
45
    }
46
}
47