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
Push — master ( 6f78dc...d7c2e2 )
by Jérémiah
21s queued 11s
created

InvalidArgumentsError   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 14
c 0
b 0
f 0
dl 0
loc 41
ccs 16
cts 16
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A toState() 0 15 3
A __construct() 0 8 1
A getErrors() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Error;
6
7
use Exception;
8
use GraphQL\Error\UserError as GraphQLUserError;
9
10
class InvalidArgumentsError extends GraphQLUserError
11
{
12
    /** @var InvalidArgumentError[] */
13
    private array $errors;
14
15 3
    public function __construct(
16
        array $errors,
17
        string $message = '',
18
        int $code = 0,
19
        Exception $previous = null
20
    ) {
21 3
        $this->errors = $errors;
22 3
        parent::__construct($message, $code, $previous);
23 3
    }
24
25
    /**
26
     * @return InvalidArgumentError[]
27
     */
28 3
    public function getErrors(): array
29
    {
30 3
        return $this->errors;
31
    }
32
33
    /**
34
     * Return a serializable array of validation errors for each argument.
35
     */
36 3
    public function toState(): array
37
    {
38 3
        $state = [];
39 3
        foreach ($this->getErrors() as $error) {
40 3
            $state[$error->getName()] = [];
41 3
            foreach ($error->getErrors() as $violation) {
42 3
                $state[$error->getName()][] = [
43 3
                    'path' => $violation->getPropertyPath(),
44 3
                    'message' => $violation->getMessage(),
45 3
                    'code' => $violation->getCode(),
46
                ];
47
            }
48
        }
49
50 3
        return $state;
51
    }
52
}
53