Google\Cloud\Dev\Snippet\SnippetTestCase::snippetFromMethod PHP Method

snippetFromMethod() public method

Retrieve a snippet from a method docblock.
public snippetFromMethod ( string $class, string $method, string | integer $indexOrName ) : Snippet
$class string The class name
$method string The method name
$indexOrName string | integer The index of the snippet, or its name.
return Snippet
    public function snippetFromMethod($class, $method, $indexOrName = 0)
    {
        $name = $class . '::' . $method;
        $identifier = $this->parser->createIdentifier($name, $indexOrName);
        $snippet = $this->coverage->cache($identifier);
        if (!$snippet) {
            $snippet = $this->parser->methodExample($class, $method, $indexOrName);
        }
        $this->coverage->cover($identifier);
        return $snippet;
    }