isInputType() public static method

public static isInputType ( mixed | AbstractType $type ) : boolean
$type mixed | AbstractType
return boolean
Example #1
0
 public function testIsInputType()
 {
     $testType = new ObjectType(['name' => 'test', 'fields' => ['name' => new StringType()]]);
     $this->assertTrue(TypeService::isInputType(new StringType()));
     $this->assertTrue(TypeService::isInputType(TypeMap::TYPE_STRING));
     $this->assertFalse(TypeService::isInputType('invalid type'));
     $this->assertFalse(TypeService::isInputType($testType));
 }
Example #2
0
 private function isInputField($data)
 {
     if (is_object($data)) {
         if ($data instanceof InputFieldInterface) {
             return true;
         } else {
             return TypeService::isInputType($data);
         }
     } else {
         if (!isset($data['type'])) {
             return false;
         }
         return TypeService::isInputType($data['type']);
     }
 }