You are here

class Any in GraphQL 8.3

Plugin annotation


@GraphQLScalar(
  id = "any",
  name = "Any",
  type = "any",
  deriver = "Drupal\graphql_core\Plugin\Deriver\Scalars\TypedDataPrimitiveFallback"
)

Hierarchy

Expanded class hierarchy of Any

File

modules/graphql_core/src/Plugin/GraphQL/Scalars/TypedData/Any.php, line 15

Namespace

Drupal\graphql_core\Plugin\GraphQL\Scalars\TypedData
View source
class Any extends ScalarPluginBase {

  /**
   * {@inheritdoc}
   */
  public static function serialize($value) {
    if (is_scalar($value)) {
      return $value;
    }
    if (is_array($value)) {
      return json_encode($value);
    }
    if (is_object($value) && method_exists($value, '__toString')) {
      return (string) $value;
    }
    return '';
  }

  /**
   * {@inheritdoc}
   */
  public static function parseValue($value) {
    return $value;
  }

  /**
   * {@inheritdoc}
   */
  public static function parseLiteral($ast) {
    return $ast->value;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Any::parseLiteral public static function Parses a node. Overrides ScalarPluginBase::parseLiteral
Any::parseValue public static function Parses a value. Overrides ScalarPluginBase::parseValue
Any::serialize public static function Serializes the scalar value. Overrides ScalarPluginBase::serialize
CacheablePluginTrait::buildCacheContexts protected function
DescribablePluginTrait::buildDescription protected function
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
ScalarPluginBase::createInstance public static function Overrides TypePluginInterface::createInstance 6
ScalarPluginBase::getDefinition public function Returns the plugin's type or field definition for the schema. Overrides TypePluginInterface::getDefinition