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
Push — master ( 4e441b...b33a6d )
by Jérémiah
39s
created

ConnectionBuilder::connectionFromArraySlice()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Overblog\GraphQLBundle\Relay\Connection\Output;
6
7
use Overblog\GraphQLBundle\Relay\Connection\ConnectionBuilder as BaseBuilder;
8
9 1
@\trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
10 1
    'Overblog\GraphQLBundle\Relay\Connection\Output\ConnectionBuilder was moved to Overblog\GraphQLBundle\Relay\Connection\ConnectionBuilder since 0.12 and will be removed in 0.13.',
11 1
    \E_USER_DEPRECATED
12
);
13
14
class ConnectionBuilder
15
{
16 21
    public static function connectionFromArray(array $data, $args = []): Connection
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

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

Loading history...
17
    {
18 21
        return self::call(__FUNCTION__, \func_get_args());
19
    }
20
21 7
    public static function connectionFromPromisedArray($dataPromise, $args = [])
0 ignored issues
show
Unused Code introduced by
The parameter $dataPromise is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

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

Loading history...
22
    {
23 7
        return self::call(__FUNCTION__, \func_get_args());
24
    }
25
26 6
    public static function connectionFromArraySlice(array $arraySlice, $args, array $meta): Connection
0 ignored issues
show
Unused Code introduced by
The parameter $arraySlice is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $meta is not used and could be removed.

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

Loading history...
27
    {
28 6
        return self::call(__FUNCTION__, \func_get_args());
29
    }
30
31 6
    public static function connectionFromPromisedArraySlice($dataPromise, $args, array $meta)
0 ignored issues
show
Unused Code introduced by
The parameter $dataPromise is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $args is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $meta is not used and could be removed.

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

Loading history...
32
    {
33 6
        return self::call(__FUNCTION__, \func_get_args());
34
    }
35
36 2
    public static function cursorForObjectInConnection(array $data, $object): ?string
0 ignored issues
show
Unused Code introduced by
The parameter $data is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $object is not used and could be removed.

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

Loading history...
37
    {
38 2
        return self::call(__FUNCTION__, \func_get_args());
39
    }
40
41 1
    public static function getOffsetWithDefault(?string $cursor, int $defaultOffset): int
0 ignored issues
show
Unused Code introduced by
The parameter $cursor is not used and could be removed.

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

Loading history...
Unused Code introduced by
The parameter $defaultOffset is not used and could be removed.

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

Loading history...
42
    {
43 1
        return self::call(__FUNCTION__, \func_get_args());
44
    }
45
46 1
    public static function offsetToCursor($offset): string
0 ignored issues
show
Unused Code introduced by
The parameter $offset is not used and could be removed.

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

Loading history...
47
    {
48 1
        return self::call(__FUNCTION__, \func_get_args());
49
    }
50
51 1
    public static function cursorToOffset($cursor): string
0 ignored issues
show
Unused Code introduced by
The parameter $cursor is not used and could be removed.

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

Loading history...
52
    {
53 1
        return self::call(__FUNCTION__, \func_get_args());
54
    }
55
56 45
    private static function call(string $func, array $arguments)
57
    {
58 45
        static $instance = null;
59 45
        if (null === $instance) {
60 1
            $instance = new BaseBuilder();
61
        }
62
63 45
        @\trigger_error(
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
64 45
            \sprintf(
65
                'Calling static method %s::%s is deprecated as of 0.12 and will be removed in 0.13. '.
66 45
                'You should use an object instance of %s to access "%s" method.',
67 45
                __CLASS__,
68 45
                $func,
69 45
                BaseBuilder::class,
70 45
                $func
71
            ),
72 45
            \E_USER_DEPRECATED
73
        );
74
75 45
        return $instance->$func(...$arguments);
76
    }
77
}
78