isInterface() public static method

public static isInterface ( AbstractType | mixed $type ) : boolean
$type AbstractType | mixed
return boolean
コード例 #1
0
 public function testTypeService()
 {
     $this->assertTrue(TypeService::isScalarType(TypeMap::TYPE_STRING));
     $this->assertFalse(TypeService::isScalarType('gibberish'));
     $this->assertFalse(TypeService::isScalarType(new TestObjectType()));
     $stringType = new StringType();
     $this->assertFalse(TypeService::isInterface($stringType));
     $this->assertEquals(TypeService::resolveNamedType($stringType), $stringType);
     $this->assertNull(TypeService::resolveNamedType(null));
     $this->assertEquals(TypeService::resolveNamedType(123), $stringType);
 }
コード例 #2
0
 private static function isArrayOfInterfaces($data)
 {
     if (!is_array($data)) {
         return false;
     }
     foreach ($data as $item) {
         if (!TypeService::isInterface($item)) {
             return false;
         }
     }
     return true;
 }