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 ( b96c2d...087fbe )
by Jérémiah
08:36
created

Resolver::getAccessor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
ccs 5
cts 5
cp 1
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
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
use GraphQL\Type\Definition\ResolveInfo;
15
use Symfony\Component\PropertyAccess\PropertyAccess;
16
use Symfony\Component\PropertyAccess\PropertyAccessor;
17
18
class Resolver
19
{
20
    /**
21
     * @var PropertyAccessor
22
     */
23
    private static $accessor;
24
25 30
    public static function defaultResolveFn($source, $args, ResolveInfo $info)
26
    {
27 30
        $fieldName = $info->fieldName;
28 30
        $property = null;
29
30 30
        $index = sprintf('[%s]', $fieldName);
31
32 30
        if (self::getAccessor()->isReadable($source, $index)) {
33 18
            $property = self::getAccessor()->getValue($source, $index);
34 30
        } elseif (is_object($source)) {
35 17
            $property = self::propertyValueFromObject($source, $fieldName);
36 17
        }
37
38 30
        return $property instanceof \Closure ? $property($source, $args, $info) : $property;
39
    }
40
41 17
    private static function propertyValueFromObject($object, $fieldName)
42
    {
43 17
        $property = null;
44
45
        // accessor try to access the value using methods
46
        // first before using public property directly
47
        // not what we wont here!
48 17
        if (isset($object->{$fieldName})) {
49 14
            $property = $object->{$fieldName};
50 17
        } elseif (self::getAccessor()->isReadable($object, $fieldName)) {
51 6
            $property = self::getAccessor()->getValue($object, $fieldName);
52 6
        }
53
54 17
        return $property;
55
    }
56
57 30
    private static function getAccessor()
58
    {
59 30
        if (null === self::$accessor) {
60 1
            self::$accessor = PropertyAccess::createPropertyAccessor();
61 1
        }
62
63 30
        return self::$accessor;
64
    }
65
}
66