Google\Cloud\Dev\Snippet\Parser\Parser::examplesFromMethod PHP Method

examplesFromMethod() public method

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.
return 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());
    }