interface Factory
{
public function sayHello();
}
class ParentClass implements Factory
{
public function sayHello()
{
echo "hello\n";
}
}
class ChildrenClass extends ParentClass
{
}
$reflect = new ReflectionClass('ParentClass');
var_dump($reflect->implementsInterface('Factory'));
$second_ref = new ReflectionClass('ChildrenClass');
var_dump($second_ref->isSubclassOf('ParentClass'));
$third_ref = new ReflectionClass('Factory');
var_dump($third_ref->isInterface());
//can not be called as static
var_dump(ReflectionClass::isInterface('Factory'));
die;
//#result
bool(true)
bool(true)
bool(true)
PHP Fatal error: Non-static method ReflectionClass::isInterface() cannot be called statically