@@ -9,8 +9,6 @@ |
||
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | use Youshido\GraphQL\Type\Config\TypeConfigInterface; |
| 12 | -use Youshido\GraphQL\Type\ListType\ListType; |
|
| 13 | -use Youshido\GraphQL\Type\Object\AbstractObjectType; |
|
| 14 | 12 | use Youshido\GraphQL\Type\TypeMap; |
| 15 | 13 | |
| 16 | 14 | class DroidType extends HumanType |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | { |
| 29 | 29 | parent::build($config); |
| 30 | 30 | |
| 31 | - $config->getField('friends')->getConfig()->set('resolve', function($droid){ |
|
| 31 | + $config->getField('friends')->getConfig()->set('resolve', function($droid) { |
|
| 32 | 32 | return StarWarsData::getFriends($droid); |
| 33 | 33 | }); |
| 34 | 34 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $preResolvedValue = $this->getPreResolvedValue($contextValue, $query); |
| 154 | 154 | |
| 155 | 155 | if ($field->getConfig()->getType()->getKind() == TypeMap::KIND_LIST) { |
| 156 | - if(!is_array($preResolvedValue)){ |
|
| 156 | + if (!is_array($preResolvedValue)) { |
|
| 157 | 157 | $value = null; |
| 158 | 158 | $this->resolveValidator->addError(new ResolveException('Not valid resolve value for list type')); |
| 159 | 159 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | if ($type->getKind() == TypeMap::KIND_ENUM) { |
| 168 | 168 | /** @var $type AbstractEnumType */ |
| 169 | - if(!$type->isValidValue($resolvedValueItem)) { |
|
| 169 | + if (!$type->isValidValue($resolvedValueItem)) { |
|
| 170 | 170 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
| 171 | 171 | |
| 172 | 172 | $listValue = null; |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $value = $listValue; |
| 184 | 184 | } else { |
| 185 | 185 | if ($field->getType()->getKind() == TypeMap::KIND_ENUM) { |
| 186 | - if(!$field->getType()->isValidValue($preResolvedValue)) { |
|
| 186 | + if (!$field->getType()->isValidValue($preResolvedValue)) { |
|
| 187 | 187 | $this->resolveValidator->addError(new ResolveException('Not valid value for enum type')); |
| 188 | 188 | $value = null; |
| 189 | 189 | } else { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $value[] = []; |
| 215 | 215 | $index = count($value) - 1; |
| 216 | 216 | |
| 217 | - if(in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE]) ) { |
|
| 217 | + if (in_array($field->getConfig()->getType()->getConfig()->getItem()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
| 218 | 218 | $type = $field->getConfig()->getType()->getConfig()->getItemConfig()->resolveType($resolvedValueItem); |
| 219 | 219 | } else { |
| 220 | 220 | $type = $field->getType(); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | { |
| 284 | 284 | $resolvedValue = $field->getConfig()->resolve($contextValue, $this->parseArgumentsValues($field, $query)); |
| 285 | 285 | |
| 286 | - if(in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])){ |
|
| 286 | + if (in_array($field->getType()->getKind(), [TypeMap::KIND_UNION, TypeMap::KIND_INTERFACE])) { |
|
| 287 | 287 | $resolvedType = $field->getType()->resolveType($resolvedValue); |
| 288 | 288 | $field->setType($resolvedType); |
| 289 | 289 | } |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | return []; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - $args = []; |
|
| 306 | + $args = []; |
|
| 307 | 307 | foreach ($query->getArguments() as $argument) { |
| 308 | 308 | $args[$argument->getName()] = $field->getConfig()->getArgument($argument->getName())->getType()->parseValue($argument->getValue()->getValue()); |
| 309 | 309 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | foreach ($fragment->getFields() as $fragmentField) { |
| 337 | 337 | $value = $this->collectValue($value, $this->executeQuery($fragmentField, $queryType, $resolvedValue)); |
| 338 | 338 | } |
| 339 | - } else if($field->getName() == self::TYPE_NAME_QUERY) { |
|
| 339 | + } else if ($field->getName() == self::TYPE_NAME_QUERY) { |
|
| 340 | 340 | $value = $this->collectValue($value, [$field->getAlias() ?: $field->getName() => $queryType->getName()]); |
| 341 | 341 | } else { |
| 342 | 342 | $value = $this->collectValue($value, $this->executeQuery($field, $queryType, $resolvedValue)); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | ->addField('kind', 'string') |
| 22 | 22 | ->addField('description', 'string') |
| 23 | 23 | ->addField('ofType', new QueryListType(), [ |
| 24 | - 'resolve' => function () { |
|
| 24 | + 'resolve' => function() { |
|
| 25 | 25 | return []; |
| 26 | 26 | } |
| 27 | 27 | ]) |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Date: 16.12.15 |
|
| 4 | - * |
|
| 5 | - * @author Portey Vasil <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Date: 16.12.15 |
|
| 4 | + * |
|
| 5 | + * @author Portey Vasil <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | namespace Youshido\Tests\Type\Union\Schema; |
| 9 | 9 | |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Date: 16.12.15 |
|
| 4 | - * |
|
| 5 | - * @author Portey Vasil <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Date: 16.12.15 |
|
| 4 | + * |
|
| 5 | + * @author Portey Vasil <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | namespace Youshido\Tests\Type\Union\Schema; |
| 9 | 9 | |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Date: 16.12.15 |
|
| 4 | - * |
|
| 5 | - * @author Portey Vasil <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Date: 16.12.15 |
|
| 4 | + * |
|
| 5 | + * @author Portey Vasil <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | namespace Youshido\Tests\Type\Union\Schema; |
| 9 | 9 | |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Date: 16.12.15 |
|
| 4 | - * |
|
| 5 | - * @author Portey Vasil <[email protected]> |
|
| 6 | - */ |
|
| 3 | + * Date: 16.12.15 |
|
| 4 | + * |
|
| 5 | + * @author Portey Vasil <[email protected]> |
|
| 6 | + */ |
|
| 7 | 7 | |
| 8 | 8 | namespace Youshido\Tests\Type\Union\Schema; |
| 9 | 9 | |