classReference
final class Reference
A Markdown link from one item to another, checked once every definition is loaded.
Properties§
public string $idpublic string $urlpublic string $fileMethods§
public function __construct(public string $id, public string $url, public string $file)Parameters
$id | string | The linked item ID |
$url | string | The link target |
$file | string | The Markdown file holding the link |
public function validate(array<string, Item> $items): voidChecks that the link points to the file and heading defining the item.
Parameters
$items | array<string, Item> | Every loaded item by ID |
Throws
InvalidInputException When the link is not local, points to another file or has the wrong fragmentTest cases 6
ReferenceTest::testValidateAcceptsALinkToTheDefiningFileAndHeadingcallsReferenceTest::testValidateRejectsALinkThatIsNotLocalcallsReferenceTest::testValidateRejectsALinkToAMissingFilecallsReferenceTest::testValidateRejectsALinkToAnotherFilecallsReferenceTest::testValidateRejectsALinkToAnUnknownItemcallsReferenceTest::testValidateRejectsTheWrongHeadingFragmentcalls
Calls 7
- function-call
parse_urlline 33 - new InvalidInputException line 35
- function-call
rawurldecodeline 37 - function-call
dirnameline 38 - function-call
realpathline 39 - function-call
strtolowerline 42 - static-call Nodes::anchor() line 42
Test cases 13§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 7
ReferenceTest::testReferenceHoldsTheLinkedIdTargetAndFilecallsReferenceTest::testValidateAcceptsALinkToTheDefiningFileAndHeadingcallsReferenceTest::testValidateRejectsALinkThatIsNotLocalcallsReferenceTest::testValidateRejectsALinkToAMissingFilecallsReferenceTest::testValidateRejectsALinkToAnotherFilecallsReferenceTest::testValidateRejectsALinkToAnUnknownItemcallsReferenceTest::testValidateRejectsTheWrongHeadingFragmentcalls