当前位置: 首页>>代码示例>>PHP>>正文


PHP Type::getInternalTypes方法代码示例

本文整理汇总了PHP中GraphQL\Type\Definition\Type::getInternalTypes方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getInternalTypes方法的具体用法?PHP Type::getInternalTypes怎么用?PHP Type::getInternalTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GraphQL\Type\Definition\Type的用法示例。


在下文中一共展示了Type::getInternalTypes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getTypeMap

 public function getTypeMap()
 {
     if (null === $this->_typeMap) {
         $map = [];
         foreach ([$this->getQueryType(), $this->getMutationType(), Introspection::_schema()] as $type) {
             $this->_extractTypes($type, $map);
         }
         $this->_typeMap = $map + Type::getInternalTypes();
     }
     return $this->_typeMap;
 }
开发者ID:rtuin,项目名称:graphql-php,代码行数:11,代码来源:Schema.php

示例2: __construct

 public function __construct(Type $querySchema = null, Type $mutationSchema = null)
 {
     Utils::invariant($querySchema || $mutationSchema, "Either query or mutation type must be set");
     $this->querySchema = $querySchema;
     $this->mutationSchema = $mutationSchema;
     // Build type map now to detect any errors within this schema.
     $map = [];
     foreach ([$this->getQueryType(), $this->getMutationType(), Introspection::_schema()] as $type) {
         $this->_extractTypes($type, $map);
     }
     $this->_typeMap = $map + Type::getInternalTypes();
     // Enforce correct interface implementations
     foreach ($this->_typeMap as $typeName => $type) {
         if ($type instanceof ObjectType) {
             foreach ($type->getInterfaces() as $iface) {
                 $this->assertObjectImplementsInterface($type, $iface);
             }
         }
     }
 }
开发者ID:ntf,项目名称:graphql-php,代码行数:20,代码来源:Schema.php

示例3: init

 /**
  * @param array $config
  */
 protected function init(array $config)
 {
     $config += ['query' => null, 'mutation' => null, 'subscription' => null, 'types' => [], 'directives' => [], 'validate' => true];
     if ($config['query'] instanceof DefinitionContainer) {
         $config['query'] = $config['query']->getDefinition();
     }
     if ($config['mutation'] instanceof DefinitionContainer) {
         $config['mutation'] = $config['mutation']->getDefinition();
     }
     if ($config['subscription'] instanceof DefinitionContainer) {
         $config['subscription'] = $config['subscription']->getDefinition();
     }
     Utils::invariant($config['query'] instanceof ObjectType, "Schema query must be Object Type but got: " . Utils::getVariableType($config['query']));
     $this->queryType = $config['query'];
     Utils::invariant(!$config['mutation'] || $config['mutation'] instanceof ObjectType, "Schema mutation must be Object Type if provided but got: " . Utils::getVariableType($config['mutation']));
     $this->mutationType = $config['mutation'];
     Utils::invariant(!$config['subscription'] || $config['subscription'] instanceof ObjectType, "Schema subscription must be Object Type if provided but got: " . Utils::getVariableType($config['subscription']));
     $this->subscriptionType = $config['subscription'];
     Utils::invariant(!$config['types'] || is_array($config['types']), "Schema types must be Array if provided but got: " . Utils::getVariableType($config['types']));
     Utils::invariant(!$config['directives'] || is_array($config['directives']) && Utils::every($config['directives'], function ($d) {
         return $d instanceof Directive;
     }), "Schema directives must be Directive[] if provided but got " . Utils::getVariableType($config['directives']));
     $this->directives = $config['directives'] ?: GraphQL::getInternalDirectives();
     // Build type map now to detect any errors within this schema.
     $initialTypes = [$config['query'], $config['mutation'], $config['subscription'], Introspection::_schema()];
     if (!empty($config['types'])) {
         $initialTypes = array_merge($initialTypes, $config['types']);
     }
     foreach ($initialTypes as $type) {
         $this->extractTypes($type);
     }
     $this->typeMap += Type::getInternalTypes();
     // Keep track of all implementations by interface name.
     $this->implementations = [];
     foreach ($this->typeMap as $typeName => $type) {
         if ($type instanceof ObjectType) {
             foreach ($type->getInterfaces() as $iface) {
                 $this->implementations[$iface->name][] = $type;
             }
         }
     }
 }
开发者ID:aeshion,项目名称:ZeroPHP,代码行数:45,代码来源:Schema.php


注:本文中的GraphQL\Type\Definition\Type::getInternalTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。