GraphQL\Utils::getVariableType PHP Метод

getVariableType() публичный статический Метод

public static getVariableType ( $var ) : string
$var
Результат string
    public static function getVariableType($var)
    {
        if ($var instanceof Type) {
            // FIXME: Replace with schema printer call
            if ($var instanceof WrappingType) {
                $var = $var->getWrappedType(true);
            }
            return $var->name;
        }
        return is_object($var) ? get_class($var) : gettype($var);
    }

Usage Example

Пример #1
0
 /**
  * @param Schema $schema
  * @param Document $ast
  * @param $rootValue
  * @param array|\ArrayAccess $variableValues
  * @param null $operationName
  * @return ExecutionResult
  */
 public static function execute(Schema $schema, Document $ast, $rootValue = null, $variableValues = null, $operationName = null)
 {
     if (!self::$UNDEFINED) {
         self::$UNDEFINED = new \stdClass();
     }
     if (null !== $variableValues) {
         Utils::invariant(is_array($variableValues) || $variableValues instanceof \ArrayAccess, "Variable values are expected to be array or instance of ArrayAccess, got " . Utils::getVariableType($variableValues));
     }
     if (null !== $operationName) {
         Utils::invariant(is_string($operationName), "Operation name is supposed to be string, got " . Utils::getVariableType($operationName));
     }
     $exeContext = self::buildExecutionContext($schema, $ast, $rootValue, $variableValues, $operationName);
     try {
         $data = self::executeOperation($exeContext, $exeContext->operation, $rootValue);
     } catch (Error $e) {
         $exeContext->addError($e);
         $data = null;
     }
     return new ExecutionResult($data, $exeContext->errors);
 }
All Usage Examples Of GraphQL\Utils::getVariableType