classTextFragment
final class TextFragment
Exact-text directives identifying complete units within a declared CSS scope.
Only the single exact form "#:~:text=percent-encoded-text" is supported.
Methods§
public static function isFragment(string $selector): boolTells whether a selector is a Text Fragment.
Parameters
$selector | string | The selector |
Returns
bool True for a fragment containing the ":~:" directive delimiterTest cases 1
Called from 5
- static-call Requirements\Config\Markdown\Citation::selector() packages/requirements/src/Config/Markdown/Citation.php:51
- static-call Requirements\Config\Markdown\Citation::validate() packages/requirements/src/Config/Markdown/Citation.php:79
- static-call Requirements\Config\Markdown\Citation::url() packages/requirements/src/Config/Markdown/Citation.php:104
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:48
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:49
public static function text(string $fragment): stringReturns the normalized text a fragment selects.
Parameters
$fragment | string | The fragment |
Returns
string The decoded, normalized textThrows
InvalidInputException When the fragment is a range, has context terms or several directives, or decodes to no textTest cases 5
TextFragmentTest::testCreateDirectiveEncodingPreservesSyntaxCharactersAndUnicodecallsTextFragmentTest::testTextDecodesAndNormalizescallsTextFragmentTest::testTextRejectsAnythingButOneExactDirectivecallsTextFragmentTest::testTextRejectsEmptyOrInvalidUtf8callsTextFragmentTest::testTextUnsupportedOrMalformedDirectivesFailExplicitlycalls
Called from 3
- static-call Requirements\Config\Markdown\Citation::selector() packages/requirements/src/Config/Markdown/Citation.php:52
- static-call Requirements\Config\Markdown\Citation::validate() packages/requirements/src/Config/Markdown/Citation.php:79
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:48
Calls 5
- function-call
preg_matchline 39 - new InvalidInputException line 40
- function-call
rawurldecodeline 42 - function-call
mb_check_encodingline 43 - static-call Unit::normalize() line 43
public static function create(string $text): stringCreates the fragment selecting a text.
Parameters
$text | string | The text |
Returns
string The fragmentTest cases 2
Called from 1
Calls 3
- function-call
str_replaceline 58 - function-call
rawurlencodeline 58 - static-call Unit::normalize() line 58
Test cases 22§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
TextFragmentTest::testCreateDirectiveEncodingPreservesSyntaxCharactersAndUnicodecallsTextFragmentTest::testCreateNormalizesTheTextcallsTextFragmentTest::testIsFragmentcallsTextFragmentTest::testTextDecodesAndNormalizescallsTextFragmentTest::testTextRejectsAnythingButOneExactDirectivecallsTextFragmentTest::testTextRejectsEmptyOrInvalidUtf8callsTextFragmentTest::testTextUnsupportedOrMalformedDirectivesFailExplicitlycalls
Other tests reaching this symbol 15
CardReaderTestcallsCitationTestcallsQuotationBlocksTestcallsQuotationTestcallsCardWriterTestcallsMarkdownDocumentTestcallsApplicationTestcallsCommandHandlerTestcallsExecutorTestcallsAnalyzerTestcallsCoverageTestcallsEvidenceMatcherTestcallsSnapshotTestcallsDomSourceTestcallsRegistryTestcalls
Relations§
Static calls 9
- static-call Requirements\Config\Markdown\Citation::selector() packages/requirements/src/Config/Markdown/Citation.php:51
- static-call Requirements\Config\Markdown\Citation::selector() packages/requirements/src/Config/Markdown/Citation.php:52
- static-call Requirements\Config\Markdown\Citation::validate() packages/requirements/src/Config/Markdown/Citation.php:79
- static-call Requirements\Config\Markdown\Citation::validate() packages/requirements/src/Config/Markdown/Citation.php:79
- static-call Requirements\Config\Markdown\Citation::url() packages/requirements/src/Config/Markdown/Citation.php:104
- static-call Requirements\Config\Markdown\Citation::url() packages/requirements/src/Config/Markdown/Citation.php:110
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:48
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:48
- static-call Requirements\Source\DomSource::select() packages/requirements/src/Source/DomSource.php:49