GraphQL\Type\Definition\ListOfType::getWrappedType PHP Метод

getWrappedType() публичный Метод

public getWrappedType ( boolean $recurse = false ) : mixed
$recurse boolean
Результат mixed
    public function getWrappedType($recurse = false)
    {
        $type = Type::resolve($this->ofType);
        return $recurse && $type instanceof WrappingType ? $type->getWrappedType($recurse) : $type;
    }

Usage Example

Пример #1
0
 /**
  * Complete a list value by completing each item in the list with the
  * inner type
  *
  * @param ExecutionContext $exeContext
  * @param ListOfType $returnType
  * @param $fieldNodes
  * @param ResolveInfo $info
  * @param array $path
  * @param $result
  * @return array|Promise
  * @throws \Exception
  */
 private static function completeListValue(ExecutionContext $exeContext, ListOfType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result)
 {
     $itemType = $returnType->getWrappedType();
     Utils::invariant(is_array($result) || $result instanceof \Traversable, 'User Error: expected iterable, but did not find one for field ' . $info->parentType . '.' . $info->fieldName . '.');
     $containsPromise = false;
     $i = 0;
     $completedItems = [];
     foreach ($result as $item) {
         $fieldPath = $path;
         $fieldPath[] = $i++;
         $completedItem = self::completeValueCatchingError($exeContext, $itemType, $fieldNodes, $info, $fieldPath, $item);
         if (!$containsPromise && self::$promiseAdapter->isPromise($completedItem)) {
             $containsPromise = true;
         }
         $completedItems[] = $completedItem;
     }
     return $containsPromise ? self::$promiseAdapter->createPromiseAll($completedItems) : $completedItems;
 }
All Usage Examples Of GraphQL\Type\Definition\ListOfType::getWrappedType