@@ 98-116 (lines=19) @@ | ||
95 | * @return \Youshido\GraphQL\Type\TypeInterface |
|
96 | * The type object. |
|
97 | */ |
|
98 | protected function buildFieldType(PluggableSchemaBuilderInterface $schemaBuilder, $field) { |
|
99 | $type = is_array($field) ? $field['type'] : $field; |
|
100 | $type = $this->parseType($type, function ($type) use ($schemaBuilder) { |
|
101 | return $schemaBuilder->findByName($type, [ |
|
102 | GRAPHQL_INPUT_TYPE_PLUGIN, |
|
103 | GRAPHQL_SCALAR_PLUGIN, |
|
104 | GRAPHQL_ENUM_PLUGIN, |
|
105 | ])->getDefinition($schemaBuilder); |
|
106 | }); |
|
107 | ||
108 | if ($type instanceof TypeInterface) { |
|
109 | $nullable = is_array($field) && array_key_exists('nullable', $field) ? (bool) $field['nullable'] : TRUE; |
|
110 | $multi = is_array($field) && array_key_exists('multi', $field) ? (bool) $field['multi'] : FALSE; |
|
111 | ||
112 | return $this->decorateType($type, $nullable, $multi); |
|
113 | } |
|
114 | ||
115 | return NULL; |
|
116 | } |
|
117 | } |
|
118 |
@@ 67-85 (lines=19) @@ | ||
64 | * @return \Youshido\GraphQL\Type\TypeInterface |
|
65 | * The type object. |
|
66 | */ |
|
67 | protected function buildArgumentType(PluggableSchemaBuilderInterface $schemaBuilder, $argument) { |
|
68 | $type = is_array($argument) ? $argument['type'] : $argument; |
|
69 | $type = $this->parseType($type, function ($type) use ($schemaBuilder) { |
|
70 | return $schemaBuilder->findByName($type, [ |
|
71 | GRAPHQL_INPUT_TYPE_PLUGIN, |
|
72 | GRAPHQL_SCALAR_PLUGIN, |
|
73 | GRAPHQL_ENUM_PLUGIN, |
|
74 | ])->getDefinition($schemaBuilder); |
|
75 | }); |
|
76 | ||
77 | if ($type instanceof TypeInterface) { |
|
78 | $nullable = is_array($argument) && array_key_exists('nullable', $argument) ? (bool) $argument['nullable'] : TRUE; |
|
79 | $multi = is_array($argument) && array_key_exists('multi', $argument) ? (bool) $argument['multi'] : FALSE; |
|
80 | ||
81 | return $this->decorateType($type, $nullable, $multi); |
|
82 | } |
|
83 | ||
84 | return NULL; |
|
85 | } |
|
86 | ||
87 | } |
|
88 |