@@ -25,23 +25,27 @@ class SpanNodeRenderer extends AbstractSpanNodeRenderer
25
25
private $ decoratedSpanNodeRenderer ;
26
26
/** @var UrlChecker|null */
27
27
private $ urlChecker ;
28
+ private $ symfonyVersion ;
28
29
29
30
public function __construct (
30
31
Environment $ environment ,
31
32
SpanNode $ span ,
32
33
BaseSpanNodeRenderer $ decoratedSpanNodeRenderer ,
33
- ?UrlChecker $ urlChecker = null
34
- ) {
34
+ ?UrlChecker $ urlChecker = null ,
35
+ string $ symfonyVersion = null
36
+ )
37
+ {
35
38
parent ::__construct ($ environment , $ span );
36
39
37
40
$ this ->decoratedSpanNodeRenderer = $ decoratedSpanNodeRenderer ;
38
41
$ this ->urlChecker = $ urlChecker ;
42
+ $ this ->symfonyVersion = $ symfonyVersion ;
39
43
}
40
44
41
45
/** @inheritDoc */
42
46
public function link (?string $ url , string $ title , array $ attributes = []): string
43
47
{
44
- $ url = (string )$ url ;
48
+ $ url = (string ) $ url ;
45
49
46
50
if (
47
51
$ this ->urlChecker &&
@@ -55,6 +59,10 @@ public function link(?string $url, string $title, array $attributes = []): strin
55
59
$ attributes = $ this ->addAttributesForUnsafeUrl ($ attributes );
56
60
}
57
61
62
+ if (null !== $ this ->symfonyVersion ) {
63
+ $ url = u ($ url )->replace ('{version} ' , $ this ->symfonyVersion )->toString ();
64
+ }
65
+
58
66
return $ this ->decoratedSpanNodeRenderer ->link ($ url , $ title , $ attributes );
59
67
}
60
68
0 commit comments