當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Type::string方法代碼示例

本文整理匯總了PHP中Type::string方法的典型用法代碼示例。如果您正苦於以下問題:PHP Type::string方法的具體用法?PHP Type::string怎麽用?PHP Type::string使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Type的用法示例。


在下文中一共展示了Type::string方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getInternalDirectives

 /**
  * @return array
  */
 public static function getInternalDirectives()
 {
     if (!self::$internalDirectives) {
         self::$internalDirectives = ['include' => new self(['name' => 'include', 'description' => 'Directs the executor to include this field or fragment only when the `if` argument is true.', 'locations' => [self::LOCATION_FIELD, self::LOCATION_FRAGMENT_SPREAD, self::LOCATION_INLINE_FRAGMENT], 'args' => [new FieldArgument(['name' => 'if', 'type' => Type::nonNull(Type::boolean()), 'description' => 'Included when true.'])]]), 'skip' => new self(['name' => 'skip', 'description' => 'Directs the executor to skip this field or fragment when the `if` argument is true.', 'locations' => [self::LOCATION_FIELD, self::LOCATION_FRAGMENT_SPREAD, self::LOCATION_INLINE_FRAGMENT], 'args' => [new FieldArgument(['name' => 'if', 'type' => Type::nonNull(Type::boolean()), 'description' => 'Skipped when true'])]]), 'deprecated' => new self(['name' => 'deprecated', 'description' => 'Marks an element of a GraphQL schema as no longer supported.', 'locations' => [self::LOCATION_FIELD_DEFINITION, self::LOCATION_ENUM_VALUE], 'args' => [new FieldArgument(['name' => 'reason', 'type' => Type::string(), 'description' => 'Explains why this element was deprecated, usually also including a ' . 'suggestion for how to access supported similar data. Formatted ' . 'in [Markdown](https://daringfireball.net/projects/markdown/).', 'defaultValue' => self::DEFAULT_DEPRECATION_REASON])]])];
     }
     return self::$internalDirectives;
 }
開發者ID:aeshion,項目名稱:ZeroPHP,代碼行數:10,代碼來源:Directive.php

示例2: testString

 /**
  * String tests
  */
 public function testString()
 {
     $this->assertSame('1', Type::string(1));
     $this->assertSame('1.2', Type::string(1.2));
     $this->assertSame('0.2', Type::string(0.2));
     $this->assertSame('1', Type::string('1'));
     $this->assertSame('rstrst1', Type::string('rstrst1'));
     $this->assertFalse(Type::isString(1));
     $this->assertTrue(Type::isString('1'));
     $this->assertFalse(Type::isString(1.2));
     $this->assertFalse(Type::isString([]));
 }
開發者ID:messyOne,項目名稱:Loo-Framework,代碼行數:15,代碼來源:TypeTest.php

示例3: str

 /**
  * @param array  $values
  * @param string $key
  * @param string $default
  * @param bool   $htmlSpecialChars
  * @return string
  */
 public static function str(array $values, $key, $default = '', $htmlSpecialChars = true)
 {
     if (isset($values[$key])) {
         $value = Type::string($values[$key]);
         return $htmlSpecialChars ? htmlspecialchars($value) : $value;
     }
     return $default;
 }
開發者ID:messyOne,項目名稱:Loo-Framework,代碼行數:15,代碼來源:Param.php

示例4: inputFields

 /**
  * Input fields for mutation.
  *
  * @return array
  */
 protected function inputFields()
 {
     return ['id' => ['name' => 'id', 'type' => Type::nonNull(Type::string())], 'name' => ['name' => 'name', 'type' => Type::nonNull(Type::string())]];
 }
開發者ID:nuwave,項目名稱:laravel-graphql-relay,代碼行數:9,代碼來源:UpdateHeroNameQuery.php

示例5: args

 /**
  * Available query arguments.
  *
  * @return array
  */
 public function args()
 {
     return ['id' => ['type' => Type::nonNull(Type::string())]];
 }
開發者ID:nuwave,項目名稱:lighthouse,代碼行數:9,代碼來源:UserQuery.php


注:本文中的Type::string方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。