Class used to find an example file's location based on a given ExampleDescriptor.

CloneableInstantiable
Methods
public find(phpDocumentor\Reflection\DocBlock\Tags\Example $example)
 
Attempts to find the example contents for the given descriptor.

  • return string
public getExampleDirectories()
 
Returns a series of directories that may contain examples.

  • return string[]
public getSourceDirectory()
 
Returns the project's root directory where an 'examples' folder can be expected.

  • return string
public setExampleDirectories(array $directories)
 
Registers a series of directories that may contain examples.

    public setSourceDirectory( $directory = '')
     
    Registers the project's root directory where an 'examples' folder can be expected.

    • return void
    Properties
    private $exampleDirectories
     


    • var string[]
    private $sourceDirectory
     


    • var string
    Methods
    private constructExamplePath( $directory, $file)
     
    Returns a path to the example file in the given directory.

    .

    • return string
    private getExampleFileContents( $filename)
     
    Attempts to find the requested example file and returns its contents or null if no file was found.

    This method will try several methods in search of the given example file, the first one it encounters is
    returned:

    1. Iterates through all examples folders for the given filename
    2. Checks the source folder for the given filename
    3. Checks the 'examples' folder in the current working directory for examples
    4. Checks the path relative to the current working directory for the given filename
    • return string|null
    private getExamplePathFromExampleDirectory( $file)
     
    Get example filepath based on the example directory inside your project.

    • return string
    private getExamplePathFromSource( $file)
     
    Get example filepath based on sourcecode.

    • return string
    © 2020 Bruce Wells
    Search Namespaces \ Classes
    ConfigurationNumbers (0-9.) only