| @@ 23-63 (lines=41) @@ | ||
| 20 | /** |
|
| 21 | * Class InterfaceDefinition |
|
| 22 | */ |
|
| 23 | class InterfaceDefinition extends AbstractTypeDefinition implements InterfaceDefinitionInterface |
|
| 24 | { |
|
| 25 | use HasInterfaces; |
|
| 26 | use HasFields; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @return TypeInterface |
|
| 30 | */ |
|
| 31 | public static function getType(): TypeInterface |
|
| 32 | { |
|
| 33 | return Type::of(Type::INTERFACE); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @param TypeDefinition $definition |
|
| 38 | * @return bool |
|
| 39 | */ |
|
| 40 | public function instanceOf($definition): bool |
|
| 41 | { |
|
| 42 | // Return a positive response if the parent type (like Object or Interface) |
|
| 43 | // can implement the desired type. |
|
| 44 | return $this->isImplements($definition) || |
|
| 45 | parent::instanceOf($definition); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return bool |
|
| 50 | */ |
|
| 51 | public function isRenderable(): bool |
|
| 52 | { |
|
| 53 | return true; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return bool |
|
| 58 | */ |
|
| 59 | public function isInputable(): bool |
|
| 60 | { |
|
| 61 | return false; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 23-63 (lines=41) @@ | ||
| 20 | /** |
|
| 21 | * Class ObjectDefinition |
|
| 22 | */ |
|
| 23 | class ObjectDefinition extends AbstractTypeDefinition implements ObjectDefinitionInterface |
|
| 24 | { |
|
| 25 | use HasInterfaces; |
|
| 26 | use HasFields; |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @return TypeInterface |
|
| 30 | */ |
|
| 31 | public static function getType(): TypeInterface |
|
| 32 | { |
|
| 33 | return Type::of(Type::INTERFACE); |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @param TypeDefinition $definition |
|
| 38 | * @return bool |
|
| 39 | */ |
|
| 40 | public function instanceOf($definition): bool |
|
| 41 | { |
|
| 42 | // Return a positive response if the parent type (like Object or Interface) |
|
| 43 | // can implement the desired type. |
|
| 44 | return $this->isImplements($definition) || |
|
| 45 | parent::instanceOf($definition); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return bool |
|
| 50 | */ |
|
| 51 | public function isRenderable(): bool |
|
| 52 | { |
|
| 53 | return true; |
|
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @return bool |
|
| 58 | */ |
|
| 59 | public function isInputable(): bool |
|
| 60 | { |
|
| 61 | return false; |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||