Finder

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

package

Default

Methods

Returns a path to the example file in the given directory.

constructExamplePath(string $directory, string $file) : string

.

Arguments

$directory

string

$file

string

Response

string

Attempts to find the example contents for the given descriptor.

find(\phpDocumentor\Descriptor\Tag\ExampleDescriptor $descriptor) : string

Arguments

Response

string

Returns a series of directories that may contain examples.

getExampleDirectories() : array<mixed,string>

Response

array<mixed,string>

Attempts to find the requested example file and returns its contents or null if no file was found.

getExampleFileContents(string $filename) : string|null

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

Arguments

$filename

string

Response

string|null

Get example filepath based on the example directory inside your project.

getExamplePathFromExampleDirectory(string $file) : string

Arguments

$file

string

Response

string

Get example filepath based on sourcecode.

getExamplePathFromSource(string $file) : string

Arguments

$file

string

Response

string

Returns the project's root directory where an 'examples' folder can be expected.

getSourceDirectory() : string

Response

string

Registers a series of directories that may contain examples.

setExampleDirectories(array<mixed,string> $directories) 

Arguments

$directories

array<mixed,string>

Registers the project's root directory where an 'examples' folder can be expected.

setSourceDirectory(string $directory = '') : void

Arguments

$directory

string

Properties

sourceDirectory

sourceDirectory : string
var

Type(s)

string

exampleDirectories

exampleDirectories : array<mixed,string>
var

Type(s)

array<mixed,string>