PHP Class Google\Cloud\Dev\Snippet\Parser\Parser

Example: $parser = new Parser;
Afficher le fichier Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Méthodes publiques

Méthode Description
allExamples ( $class ) : array Retrieve all examples from a class and its methods.
classExample ( string $class, integer | string $index ) : Snippet Get a snippet from a class.
createIdentifier ( $fqn, $indexOrName )
examples ( DocBlock $docBlock, $fullyQualifiedName, string $file, integer $line, array $magicMethods = [] ) : array Parse examples from a DocBlock object.
examplesFromClass ( object | ReflectionClas\ReflectionClass $class ) : array Retrieve all examples from a class Doc Block.
examplesFromMethod ( object $class, string | ReflectionMetho\ReflectionMethod $method ) : array Retrieve all examples from a method's Doc Block.
methodExample ( string $class, string $method, integer $index ) : Snippet Get a snippet from a method.

Private Methods

Méthode Description
buildMagicMethods ( $magicMethods, $className )
extractSnippetName ( $content )

Method Details

allExamples() public méthode

Example: $examples = $parser->allExamples($parser);
public allExamples ( $class ) : array
Résultat array

classExample() public méthode

Example: $snippet = $parser->classExample(Parser::class);
public classExample ( string $class, integer | string $index ) : Snippet
$class string the name of the class
$index integer | string The index of the example to return.
Résultat Snippet

createIdentifier() public méthode

public createIdentifier ( $fqn, $indexOrName )

examples() public méthode

Example: Yeah, this example is pretty useless. $examples = $parser->examples($docBlock);
public examples ( DocBlock $docBlock, $fullyQualifiedName, string $file, integer $line, array $magicMethods = [] ) : array
$docBlock phpDocumentor\Reflection\DocBlock The DocBlock to parse
$file string The filename the docblock is in
$line integer The line where the tested method or class is declared.
$magicMethods array
Résultat array

examplesFromClass() public méthode

Example: $examples = $parser->examplesFromClass($parser);
public examplesFromClass ( object | ReflectionClas\ReflectionClass $class ) : array
$class object | ReflectionClas\ReflectionClass An instance or reflector of the class to parse examples from.
Résultat array

examplesFromMethod() public méthode

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.
Résultat array

methodExample() public méthode

Example: $snippet = $parser->methodExample(Parser::class, 'methodExample'); Get the 2nd example (index=1) $snippet = $parser->methodExample(Parser::class, 'methodExample', 1);
public methodExample ( string $class, string $method, integer $index ) : Snippet
$class string The name of the class.
$method string The name of the method.
$index integer The 0-indexed example to return.
Résultat Snippet