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

snippetFromClass() public method

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