1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of Railt package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
*/ |
8
|
|
|
declare(strict_types=1); |
9
|
|
|
|
10
|
|
|
namespace Railt\Reflection\Introspection\Object; |
11
|
|
|
|
12
|
|
|
use Railt\Reflection\Definition\ObjectDefinition; |
13
|
|
|
use Railt\Reflection\Document; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Class TypeObject |
17
|
|
|
*/ |
18
|
|
|
final class TypeObject extends ObjectDefinition |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
public const TYPE_NAME = '__Type'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
public const TYPE_DESCRIPTION = 'The fundamental unit of any GraphQL Schema is the type. There are |
29
|
|
|
many kinds of types in GraphQL as represented by the __TypeKind enum. |
30
|
|
|
|
31
|
|
|
Depending on the kind of a type, certain fields describe information |
32
|
|
|
about that type. Scalar types provide no information beyond a name |
33
|
|
|
and description, while Enum types provide their values. Object and |
34
|
|
|
Interface types provide the fields they describe. Abstract types, |
35
|
|
|
Union and Interface, provide the Object types possible at runtime. |
36
|
|
|
List and NonNull types compose other types.'; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var int |
40
|
|
|
*/ |
41
|
|
|
public const TYPE_LINE = 36; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* SchemaObject constructor. |
45
|
|
|
* @param Document $document |
46
|
|
|
*/ |
47
|
9 |
|
public function __construct(Document $document) |
48
|
|
|
{ |
49
|
9 |
|
parent::__construct($document, static::TYPE_NAME); |
50
|
|
|
|
51
|
9 |
|
$this->withDescription(self::TYPE_DESCRIPTION); |
52
|
9 |
|
$this->withLine(self::TYPE_LINE); |
53
|
9 |
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @return bool |
57
|
|
|
*/ |
58
|
|
|
public function isBuiltin(): bool |
59
|
|
|
{ |
60
|
|
|
return true; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|