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

snippetFromMagicMethod() public method

Retrieve a snippet from a magic method docblock (i.e. @method tag nexted inside a class-level docblock).
public snippetFromMagicMethod ( 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 snippetFromMagicMethod($class, $method, $indexOrName = 0)
    {
        $name = $class . '::' . $method;
        $identifier = $this->parser->createIdentifier($name, $indexOrName);
        $snippet = $this->coverage->cache($identifier);
        if (!$snippet) {
            throw new \Exception('Magic Method ' . $name . ' was not found');
        }
        $this->coverage->cover($identifier);
        return $snippet;
    }