Check Sources
Each Check runs independently from each other.
This means that every Pheck is responsible for getting a "source" of files or "input", and then process each one of them to see if it can find a violation.
These Source classes are useful for extracting the input we want to analyze.
The `run()` method
All Sources implement a run
method. It will return a MatchCollection.
A match collection is a collection of the pair value|FileMatch
. This means that your collection will know the File (and sometimes line) and the context.
List of Sources
If you're interested in creating your own source, take a look at the advanced section.
GrepSource
Perhaps the most used one. It allows you to specify a pattern
and files
. This class is a wrapper around the grep
command.
ClassSource
Given a directory, it will return the Classes (with Full Qualifier Name) inside. It can be recursive.
FileSource
Given a directory, it will return the Files inside. It can be recursive.
ConfigSource
Outputs the entire configuration.
Note: the configuration is dotted.
This is the example of the MatchCollection to array.
RouteCommandSource
Outputs the routes. It runs php artisan route:list --json
behind the scenes.
This is the example of the MatchCollection to array.
Last updated