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

Completed
Pull Request — master (#536)
by
unknown
30:49 queued 05:45
created

Formatter::onErrorFormatting()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 18
rs 9.8666
cc 3
nc 3
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Validator;
6
7
use Overblog\GraphQLBundle\Event\ErrorFormattingEvent;
8
use Overblog\GraphQLBundle\Exception\ArgumentsValidationException;
9
10
class Formatter
11
{
12
    public function onErrorFormatting(ErrorFormattingEvent $event): void
13
    {
14
        $error = $event->getError()->getPrevious();
15
16
        if ($error instanceof ArgumentsValidationException) {
17
            $state = [];
18
            $code = [];
19
20
            $violations = $error->getViolations();
21
            foreach ($violations as $violation) {
22
                $state[$violation->getPropertyPath()][] = $violation->getMessage();
23
                $code[$violation->getPropertyPath()][] = $violation->getCode();
24
            }
25
26
            $formattedError = $event->getFormattedError();
27
            $formattedError->offsetSet('state', $state);
28
            $formattedError->offsetSet('code', $code);
29
            $formattedError->offsetUnset('locations');
30
        }
31
    }
32
}
33