Reflection ReflectionClass::getMethod
(PHP 5, PHP 7, PHP 8)
ReflectionClass::getMethod — 클래스 메서드에 대한 ReflectionMethod를 가져옵니다.
설명
public ReflectionClass::getMethod(string $name
): ReflectionMethod
클래스 메서드에 대한 ReflectionMethod를 가져옵니다.
매개변수
name
- 반영할 메서드 이름입니다.
반환 값
오류/예외
메서드가 존재하지 않는 경우 ReflectionException입니다.
Examples
예제 #1 ReflectionClass::getMethod()의 기본 사용법
<?php
$class = new ReflectionClass('ReflectionClass');
$method = $class->getMethod('getMethod');
var_dump($method);
?>
위의 예는 다음을 출력합니다.
object(ReflectionMethod)#2 (2) { ["name"]=> string(9) "getMethod" ["class"]=> string(15) "ReflectionClass" }
기타
- ReflectionClass::getMethods() - 메서드 배열을 가져옵니다.