update : 2015.11.03
php.shukuma.com

검색:
 
 
Gets declaring class for the reflected method.

ReflectionMethod::getDeclaringClass

(PHP 5)

ReflectionMethod::getDeclaringClassGets declaring class for the reflected method.

설명

public ReflectionClass ReflectionMethod::getDeclaringClass ( void )

Gets the declaring class for the reflected method.

인수

이 함수는 인수가 없습니다.

반환값

A ReflectionClass object of the class that the reflected method is part of.

예제

Example #1 ReflectionMethod::getDeclaringClass() example

<?php
class HelloWorld {

    protected function 
sayHelloTo($name) {
        return 
'Hello ' $name;
    }

}

$reflectionMethod = new ReflectionMethod(new HelloWorld(), 'sayHelloTo');
var_dump($reflectionMethod->getDeclaringClass());
?>

위 예제의 출력:

object(ReflectionClass)#2 (1) {
  ["name"]=>
  string(10) "HelloWorld"
}

참고