Skip to content

Commit e00b3a7

Browse files
committed
[DomCrawler] Improve the sprintf() call in selectLink()
1 parent fb7fcdd commit e00b3a7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Crawler.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -710,10 +710,9 @@ public function filter($selector)
710710
*/
711711
public function selectLink($value)
712712
{
713-
$xpath = sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) ', static::xpathLiteral(' '.$value.' ')).
714-
sprintf('or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)]]', static::xpathLiteral(' '.$value.' '));
715-
716-
return $this->filterRelativeXPath($xpath);
713+
return $this->filterRelativeXPath(
714+
sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %1$s) or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %1$s)]]', static::xpathLiteral(' '.$value.' '))
715+
);
717716
}
718717

719718
/**

0 commit comments

Comments
 (0)