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 — 0.11 (#455)
by Jérémiah
16:51
created

Resolver::getDroid()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLPhpGenerator 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\GraphQLGenerator\Tests;
13
14
use GraphQL\Tests\StarWarsData;
15
use GraphQL\Type\Definition\Type;
16
17
abstract class Resolver
18
{
19
    /** @var Type */
20
    private static $humanType;
21
22
    /** @var Type */
23
    private static $droidType;
24
25
    private function __construct()
26
    {
27
    }
28
29
    public static function getHumanType()
30
    {
31
        return self::$humanType;
32
    }
33
34
    public static function getDroidType()
35
    {
36
        return self::$droidType;
37
    }
38
39
    /**
40
     * @param Type $humanType
41
     */
42
    public static function setHumanType($humanType)
43
    {
44
        self::$humanType = $humanType;
45
    }
46
47
    /**
48
     * @param Type $droidType
49
     */
50
    public static function setDroidType($droidType)
51
    {
52
        self::$droidType = $droidType;
53
    }
54
55
    public static function resolveType($obj)
56
    {
57
        $humans = StarWarsData::humans();
58
        $droids = StarWarsData::droids();
59
        if (isset($humans[$obj['id']])) {
60
            return static::getHumanType();
61
        }
62
        if (isset($droids[$obj['id']])) {
63
            return static::getDroidType();
64
        }
65
        return null;
66
    }
67
68
    public static function getFriends($droidOrHuman)
69
    {
70
        return StarWarsData::getFriends($droidOrHuman);
71
    }
72
73
    public static function getHero($root, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

73
    public static function getHero(/** @scrutinizer ignore-unused */ $root, $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
74
    {
75
        return StarWarsData::getHero(isset($args['episode']['name']) ? $args['episode']['name'] : null);
76
    }
77
78
    public static function getHuman($root, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

78
    public static function getHuman(/** @scrutinizer ignore-unused */ $root, $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
79
    {
80
        $humans = StarWarsData::humans();
81
        return isset($humans[$args['id']]) ? $humans[$args['id']] : null;
82
    }
83
84
    public static function getDroid($root, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

84
    public static function getDroid(/** @scrutinizer ignore-unused */ $root, $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
85
    {
86
        $droids = StarWarsData::droids();
87
        return isset($droids[$args['id']]) ? $droids[$args['id']] : null;
88
    }
89
90
    public static function getDateTime($root, $args)
0 ignored issues
show
Unused Code introduced by
The parameter $root is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

90
    public static function getDateTime(/** @scrutinizer ignore-unused */ $root, $args)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
91
    {
92
        return isset($args['dateTime']) ? $args['dateTime'] : new \DateTime('2016-11-28 12:00:00');
93
    }
94
}
95