classTextSource
final class TextSource
implements SourceExtension
Selects nonblank lines of a plain-text source with lines:START-END or lines:NUMBER.
Methods§
public function __construct(private ResourceLoader $loader = new \Requirements\Source\ResourceLoader())Parameters
$loader | ResourceLoader | Reads the source document |
Calls 1
public function select(
Source $source,
string $selector,
string $directory,
bool $live,
): list<Unit>Selects the nonblank lines of a line range.
Parameters
$source | Source | The source declaration |
$selector | string | The line range |
$directory | string | The configuration directory |
$live | bool | Whether to read the current URI instead of a pinned snapshot |
Returns
list<Unit> One unit per nonblank line, located as line:NThrows
RuntimeException When the selector is malformed, the range lies outside the source or the source cannot be readTest cases 6
SourceExtensionTest::testSelectReturnsTheUnitsOfTheScopeOrOfAnEvidenceSelectorcallsTextSourceTest::testSelectLocatesNonblankLinescallsTextSourceTest::testSelectReadsThroughTheGivenLoadercallsTextSourceTest::testSelectRejectsMalformedSelectorscallsTextSourceTest::testSelectRejectsRangesOutsideTheSourcecallsTextSourceTest::testSelectStableDistinctUnitscalls
Calls 7
- function-call
preg_matchline 38 - new
RuntimeExceptionline 39 - function-call
preg_splitline 43 - method-call ResourceLoader::read() line 43
- function-call
countline 44 - static-call Unit::normalize() line 49
- new Unit line 51
Private surface 1§
Implementation details, listed for orientation only.
private ResourceLoader $loader = new \Requirements\Source\ResourceLoader()Test cases 19§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
Other tests reaching this symbol 14
LoaderTestcallsMarkdownDocumentTestcallsApplicationTestcallsCommandHandlerTestcallsCommandLineTestcallsExecutorTestcallsFormatterTestcallsAnalyzerTestcallsCoverageTestcallsEvidenceMatcherTestcallsSnapshotTestcallsRegistryTest::providerGetBuiltIncallsSourceExtensionTest::testSelectReturnsTheUnitsOfTheScopeOrOfAnEvidenceSelectorcallsVerifierTestcalls