isInterface() public method

Is this reflection an interface?
public isInterface ( ) : boolean
return boolean
 /**
  * @dataProvider internalSymbolsProvider
  *
  * @param string $className
  * @throws \ReflectionException
  */
 public function testCanReflectInternalClasses($className)
 {
     /* @var $class */
     $phpInternalSourceLocator = new PhpInternalSourceLocator();
     $reflector = new ClassReflector($phpInternalSourceLocator);
     try {
         $class = $reflector->reflect($className);
     } catch (\ReflectionException $e) {
         if ($phpInternalSourceLocator->hasStub($className)) {
             throw $e;
         }
         $this->markTestIncomplete(sprintf('Can\'t reflect class "%s" due to an internal reflection exception: "%s". Consider adding a stub class', $className, $e->getMessage()));
     }
     $this->assertInstanceOf(ReflectionClass::class, $class);
     $this->assertSame($className, $class->getName());
     $this->assertTrue($class->isInternal());
     $this->assertFalse($class->isUserDefined());
     $internalReflection = new \ReflectionClass($className);
     $this->assertSame($internalReflection->isInterface(), $class->isInterface());
     $this->assertSame($internalReflection->isTrait(), $class->isTrait());
 }
 /**
  * {@inheritDoc}
  */
 public function isInterface()
 {
     return $this->betterReflectionClass->isInterface();
 }
Example #3
0
 /**
  * @param ReflectionClass $class
  *
  * @return bool
  */
 protected function isInterface(ReflectionClass $class)
 {
     return $class->isInterface() || substr($class->getName(), -strlen('Interface')) === 'Interface';
 }
Example #4
0
 /**
  * getLongClassType returns the type of class: `Class`, `Interface` or `Trait`.
  *
  * @param \BetterReflection\Reflection\ReflectionClass $class
  *
  * @return string
  */
 public function getLongClassType(ReflectionClass $class)
 {
     $type = 'Class';
     if ($class->isInterface()) {
         $type = 'Interface';
     } elseif ($class->isTrait()) {
         $type = 'Trait';
     }
     return $type;
 }