Google\Cloud\Dev\Snippet\Parser\Parser::examplesFromMethod PHP 메소드

examplesFromMethod() 공개 메소드

Example: $examples = $parser->examplesFromMethod($parser, 'examplesFromMethod');
public examplesFromMethod ( object $class, string | ReflectionMetho\ReflectionMethod $method ) : array
$class object An instance of the class to parse examples from.
$method string | ReflectionMetho\ReflectionMethod The name of the method to parse examples from.
리턴 array
    public function examplesFromMethod($class, $method)
    {
        if (!$method instanceof ReflectionMethod) {
            $method = new ReflectionMethod($class, $method);
        }
        $doc = new DocBlock($method);
        $parent = $method->getDeclaringClass();
        $class = $parent->getName();
        return $this->examples($doc, $class . '::' . $method->getName(), $method->getFileName(), $method->getStartLine());
    }