| @@ 18-39 (lines=22) @@ | ||
| 15 | use Youshido\GraphQL\Type\Config\TypeConfigInterface; |
|
| 16 | use Youshido\GraphQL\Type\TypeMap; |
|
| 17 | ||
| 18 | class EnumTypeConfig extends Config implements TypeConfigInterface |
|
| 19 | { |
|
| 20 | use FieldsAwareTrait, ArgumentsAwareTrait; |
|
| 21 | ||
| 22 | public function getRules() |
|
| 23 | { |
|
| 24 | return [ |
|
| 25 | 'name' => ['type' => TypeMap::TYPE_STRING, 'required' => true], |
|
| 26 | 'description' => ['type' => TypeMap::TYPE_STRING], |
|
| 27 | 'values' => ['type' => TypeMap::TYPE_ARRAY_OF_VALUES, 'required' => true], |
|
| 28 | ]; |
|
| 29 | } |
|
| 30 | ||
| 31 | public function getValues() |
|
| 32 | { |
|
| 33 | return $this->get('values', []); |
|
| 34 | } |
|
| 35 | ||
| 36 | protected function build() |
|
| 37 | { |
|
| 38 | } |
|
| 39 | } |
|
| @@ 18-38 (lines=21) @@ | ||
| 15 | use Youshido\GraphQL\Type\Config\TypeConfigInterface; |
|
| 16 | use Youshido\GraphQL\Type\TypeMap; |
|
| 17 | ||
| 18 | class InterfaceTypeConfig extends Config implements TypeConfigInterface |
|
| 19 | { |
|
| 20 | use FieldsAwareTrait, ArgumentsAwareTrait; |
|
| 21 | ||
| 22 | public function getRules() |
|
| 23 | { |
|
| 24 | return [ |
|
| 25 | 'name' => ['type' => TypeMap::TYPE_STRING, 'required' => true], |
|
| 26 | 'fields' => ['type' => TypeMap::TYPE_ARRAY_OF_FIELDS], |
|
| 27 | 'description' => ['type' => TypeMap::TYPE_STRING], |
|
| 28 | 'resolveType' => ['type' => TypeMap::TYPE_FUNCTION] |
|
| 29 | ]; |
|
| 30 | } |
|
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | protected function build() |
|
| 35 | { |
|
| 36 | $this->buildFields(); |
|
| 37 | } |
|
| 38 | } |
|