|
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( |
|
|
|
|
|
|
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 |
|
|
|
|
|
|
17
|
|
|
{ |
|
18
|
21 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
19
|
|
|
} |
|
20
|
|
|
|
|
21
|
7 |
|
public static function connectionFromPromisedArray($dataPromise, $args = []) |
|
|
|
|
|
|
22
|
|
|
{ |
|
23
|
7 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
6 |
|
public static function connectionFromArraySlice(array $arraySlice, $args, array $meta): Connection |
|
|
|
|
|
|
27
|
|
|
{ |
|
28
|
6 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
6 |
|
public static function connectionFromPromisedArraySlice($dataPromise, $args, array $meta) |
|
|
|
|
|
|
32
|
|
|
{ |
|
33
|
6 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
2 |
|
public static function cursorForObjectInConnection(array $data, $object): ?string |
|
|
|
|
|
|
37
|
|
|
{ |
|
38
|
2 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
1 |
|
public static function getOffsetWithDefault(?string $cursor, int $defaultOffset): int |
|
|
|
|
|
|
42
|
|
|
{ |
|
43
|
1 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
1 |
|
public static function offsetToCursor($offset): string |
|
|
|
|
|
|
47
|
|
|
{ |
|
48
|
1 |
|
return self::call(__FUNCTION__, \func_get_args()); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
1 |
|
public static function cursorToOffset($cursor): string |
|
|
|
|
|
|
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( |
|
|
|
|
|
|
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
|
|
|
|
If you suppress an error, we recommend checking for the error condition explicitly: