interfaceSourceExtension
interface SourceExtension
Public API: explicitly declared with
@visibility public.Reads a source format and selects the units that coverage counts and evidence quotes.
A unit has a stable location and its complete normalized text. The same method selects the coverage scope, with the source's own selector, and the unit an evidence entry names, with that entry's selector.
$notes = new class () implements \Requirements\Source\SourceExtension { public function select(\Requirements\Model\Source $source, string $selector, string $directory, bool $live): array { return [new \Requirements\Source\Unit('note:1', 'Names start with a letter.')]; } };
$notes->select(new \Requirements\Model\Source('notes', 'memory:notes', 'notes', '*'), '*', '/', false)[0]->text // => 'Names start with a letter.'Methods§
public function select(
Source $source,
string $selector,
string $directory,
bool $live,
): list<Unit>Selects source units.
Parameters
$source | Source | The source declaration |
$selector | string | The scope selector or an evidence selector |
$directory | string | The configuration directory that relative paths resolve against |
$live | bool | Whether to read the current URI instead of a pinned snapshot |
Returns
list<Unit> The selected unitsTest cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SourceExtensionTestcalls
Other tests reaching this symbol 2
MemorySourcecallsUnreadableSourcecalls
Relations§
Implemented by 5
- DomSource packages/requirements/src/Source/DomSource.php:23
- JsonSource packages/requirements/src/Source/JsonSource.php:18
- TextSource packages/requirements/src/Source/TextSource.php:14
- MemorySource packages/requirements/tests/Fake/MemorySource.php:15
- UnreadableSource packages/requirements/tests/Fake/UnreadableSource.php:15