Skip to content

Commit 61a9d47

Browse files
committed
links.php: Enh doc
1 parent aefb01c commit 61a9d47

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tools/links/links.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public function isTested(): bool
113113
}
114114

115115
/**
116-
* The raw URL
116+
* Get the raw URL.
117117
*
118118
* @return string
119119
*/
@@ -122,6 +122,9 @@ public function getUrl(): string
122122
return $this->url;
123123
}
124124

125+
/**
126+
* Execute URL transformations like replacements.
127+
*/
125128
public function getTransformedUrl(): string
126129
{
127130
if (null === $this->transformedUrl) {
@@ -282,7 +285,7 @@ public function isInternal(): bool
282285
*
283286
* If the URL is external, return the response HTTP headers (as an array), the HTTP status code as an integer, the eventual `location` HTTP header used for redirection, if there is a fragment to test, if that fragment has been found in the content available at the URL
284287
* If the URL is internal, return the code 200 if the target exists, 404 if not, if there is a fragment to test, if that fragment has been found in the content available at the URL
285-
* @param string $url The URL istsel
288+
* @param string $url The URL itself
286289
* @param bool|null $external If it's an external URL (`true`) or not (`false`), if `null`, the system try to guess it using {@see \TestableUrl::isExternalUrl()}
287290
* @param bool $testFragment If the eventual fragment/hash/anchor part should be tested
288291
* @param int $retryCount Number of retries on time out
@@ -703,6 +706,7 @@ public static function convertPatternFromPhpToGrep(string $pattern): string
703706

704707
public function getGrepUrlSearchPattern(string $extension, string $url): string
705708
{
709+
// If (.md and $find…)
706710
return implode('|', array_map(function (string $pattern) use ($url) {
707711
return
708712
self::convertPatternFromPhpUrlExtractionToGrepUrlSearch($pattern, $url)
@@ -1079,7 +1083,7 @@ public function testResources(int $verbosity = self::VERBOSITY_DEFAULT): bool
10791083
$found = false;
10801084
foreach ($this->getUsageFiles() as $usageFile) {
10811085
$relativeUrl = TestableUrl::getRelativePath($usageFile, $url);
1082-
$grepOutput = trim(shell_exec($this->urlExtractor->getGrepUrlSearchCommand($usageFile, $relativeUrl)));
1086+
$grepOutput = trim(shell_exec($this->urlExtractor->getGrepUrlSearchCommand($usageFile, $relativeUrl))??'');
10831087
if (!empty($grepOutput)) {
10841088
$found = true;
10851089
break;

0 commit comments

Comments
 (0)