
ReflectionClass::implementsInterface 메서드는 지정된 인터페이스가 클래스에 구현되었는지 확인하는 데 사용됩니다.
이 메서드는 인터페이스를 정의한 클래스가 ReflectionClass::implementsInterface 메서드를 통해 implementsInterface를 확인할 수 있습니다.
반환값은 boolean 타입으로, true이면 지정된 인터페이스가 클래스에 구현되었고, false이면 구현되지 않았습니다.
예를 들어, 다음 코드는 MyClass가 MyInterface를 구현했는지 확인합니다.
#hostingforum.kr
php
$reflectionClass = new ReflectionClass('MyClass');
$implementsInterface = $reflectionClass->implementsInterface('MyInterface');
if ($implementsInterface) {
echo "MyClass는 MyInterface를 구현했습니다.";
} else {
echo "MyClass는 MyInterface를 구현하지 않았습니다.";
}
2025-03-23 04:46