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 (#264)
by Jérémiah
11:57
created

CustomErrorFormatter   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A format() 0 12 3
A __invoke() 0 4 1
1
<?php
2
3
namespace Overblog\GraphQLBundle\Tests\Error;
4
5
use GraphQL\Error\Error;
6
use GraphQL\Error\FormattedError;
7
8
class CustomErrorFormatter
9
{
10
    /**
11
     * @param \Throwable $e
12
     *
13
     * @return array
14
     */
15
    public static function format($e)
16
    {
17
        $code = $e->getCode();
18
        if ($e instanceof Error && $e->getPrevious()) {
19
            $code = $e->getPrevious()->getCode();
20
        }
21
22
        $formattedError = FormattedError::createFromException($e);
23
        $formattedError['code'] = $code;
24
25
        return $formattedError;
26
    }
27
28
    /**
29
     * @param \Throwable $e
30
     *
31
     * @return array
32
     */
33
    public function __invoke($e)
34
    {
35
        return static::format($e);
36
    }
37
}
38