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
18:23 queued 15:24
created

ValidatorFactory::createValidator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2.0625

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 8
c 2
b 0
f 0
dl 0
loc 14
ccs 6
cts 8
cp 0.75
rs 10
cc 2
nc 2
nop 1
crap 2.0625
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
class ValidatorFactory
14
{
15
    private $defaultValidator;
16
    private $defaultTranslator;
17
    private $constraintValidatorFactory;
18
19 106
    public function __construct(?ValidatorInterface $validator, ConstraintValidatorFactoryInterface $constraintValidatorFactory, ?TranslatorInterface $translator)
20
    {
21 106
        $this->defaultValidator = $validator;
22 106
        $this->defaultTranslator = $translator;
23 106
        $this->constraintValidatorFactory = $constraintValidatorFactory;
24 106
    }
25
26 10
    public function createValidator(MetadataFactory $metadataFactory): ValidatorInterface
27
    {
28 10
        $builder = Validation::createValidatorBuilder()
29 10
            ->setMetadataFactory($metadataFactory)
30 10
            ->setConstraintValidatorFactory($this->constraintValidatorFactory)
31
        ;
32
33 10
        if (null !== $this->defaultTranslator) {
34
            $builder
35
                ->setTranslator($this->defaultTranslator)
36
                ->setTranslationDomain('validators');
37
        }
38
39 10
        return $builder->getValidator();
40
    }
41
}
42