Properties
$sourceDirectory Line 33
private$sourceDirectory : string
$exampleDirectories Line 36
private$exampleDirectories : string[]
Methods
find() Line 41
Attempts to find the example contents for the given descriptor.
publicfind(ExampleDescriptor $descriptor) : string
setSourceDirectory() Line 59
Registers the project's root directory where an 'examples' folder can be expected.
publicsetSourceDirectory([string $directory = '' ]) : void
Parameters
getSourceDirectory() Line 67
Returns the project's root directory where an 'examples' folder can be expected.
publicgetSourceDirectory() : string
Returns
string —
setExampleDirectories() Line 77
Registers a series of directories that may contain examples.
publicsetExampleDirectories([string[] $directories = [] ]) : void
Parameters
getExampleDirectories() Line 87
Returns a series of directories that may contain examples.
publicgetExampleDirectories() : string[]
Returns
string[] —
getExampleFileContents() Line 105
Attempts to find the requested example file and returns its contents or null if no file was found.
privategetExampleFileContents(string $filename) : array
This method will try several methods in search of the given example file, the first one it encounters is returned:
- Iterates through all examples folders for the given filename
- Checks the source folder for the given filename
- Checks the 'examples' folder in the current working directory for examples
- Checks the path relative to the current working directory for the given filename
Parameters
Returns
array —
getExamplePathFromExampleDirectory() Line 133
Get example filepath based on the example directory inside your project.
privategetExamplePathFromExampleDirectory(string $file) : string
Parameters
Returns
string —
constructExamplePath() Line 141
Returns a path to the example file in the given directory.
privateconstructExamplePath(string $directory, string $file) : string
.
Parameters
Returns
string —
getExamplePathFromSource() Line 149
Get example filepath based on sourcecode.
privategetExamplePathFromSource(string $file) : string