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 (#7)
by Jérémiah
09:02
created

AbstractResolver::addSolution()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 13
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 3
crap 2
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Resolver;
13
14
abstract class AbstractResolver implements ResolverInterface
15
{
16
    /**
17
     * @var array
18
     */
19
    private $solutions = [];
20
21
    /**
22
     * @var array
23
     */
24
    private $solutionOptions = [];
25
26 44
    public function addSolution($name, $solution, $options = [])
27
    {
28 44
        if (!$this->supportsSolution($solution)) {
29 1
            throw new UnsupportedResolverException(
30 1
                sprintf('Resolver "%s" must be "%s" "%s" given.', $name, $this->supportedSolutionClass(), get_class($solution))
31 1
            );
32
        }
33
34 44
        $this->solutions[$name] = $solution;
35 44
        $this->solutionOptions[$name] = $options;
36
37 44
        return $this;
38
    }
39
40
    /**
41
     * @param $name
42
     *
43
     * @return mixed
44
     */
45 47
    public function getSolution($name)
46
    {
47 47
        return isset($this->solutions[$name]) ? $this->solutions[$name] : null;
48
    }
49
50
    /**
51
     * @param $name
52
     *
53
     * @return mixed
54
     */
55 28
    public function getSolutionOptions($name)
56
    {
57 28
        return isset($this->solutionOptions[$name]) ? $this->solutionOptions[$name] : [];
58
    }
59
60
    /**
61
     * @param mixed $solution
62
     *
63
     * @return bool
64
     */
65 44
    protected function supportsSolution($solution)
66
    {
67 44
        $supportedClass = $this->supportedSolutionClass();
68
69 44
        return  null === $supportedClass || $solution instanceof $supportedClass;
70
    }
71
72
    /**
73
     * default return null to accept mixed type.
74
     *
75
     * @return null|string supported class name
76
     */
77 19
    protected function supportedSolutionClass()
78
    {
79 19
        return;
80
    }
81
}
82