@@ -29,7 +29,7 @@ public function __construct(
2929 private readonly iterable $ patternResolvers ,
3030 /** @var iterable<SupportingPlaceholderResolverInterface> */
3131 private readonly iterable $ supportingResolvers ,
32- #[Autowire('messaging.always_add_user_track ' )] private readonly bool $ alwaysAddUserTrack ,
32+ #[Autowire('% messaging.always_add_user_track% ' )] private readonly bool $ alwaysAddUserTrack ,
3333 ) {
3434 }
3535
@@ -61,12 +61,6 @@ public function process(
6161 name: 'ORGANIZATION_NAME ' ,
6262 resolver: fn (PlaceholderContext $ ctx ) => $ this ->config ->getValue (ConfigOption::OrganisationName) ?? ''
6363 );
64- $ resolver ->register (
65- name: 'CONTACTURL ' ,
66- resolver: fn (PlaceholderContext $ ctx ) => htmlspecialchars (
67- $ this ->config ->getValue (ConfigOption::VCardUrl) ?? ''
68- )
69- );
7064
7165 foreach ($ this ->placeholderResolvers as $ placeholderResolver ) {
7266 $ resolver ->register ($ placeholderResolver ->name (), $ placeholderResolver );
@@ -100,33 +94,33 @@ public function process(
10094 );
10195 }
10296
103- private function appendContent (string $ message , string $ append ): string
104- {
105- if (preg_match ('#</body>#i ' , $ message )) {
106- $ message = preg_replace ('#</body>#i ' , $ append . '</body> ' , $ message );
107- } else {
108- $ message .= $ append ;
109- }
110-
111- return $ message ;
112- }
113-
11497 private function ensureStandardPlaceholders (string $ value , OutputFormat $ format ): string
11598 {
116- if (!strpos ($ value , '[FOOTER] ' )) {
99+ if (!str_contains ($ value , '[FOOTER] ' )) {
117100 $ sep = $ format === OutputFormat::Html ? '<br /> ' : "\n\n" ;
118101 $ value = $ this ->appendContent ($ value , $ sep . '[FOOTER] ' );
119102 }
120103
121- if (!strpos ($ value , '[SIGNATURE] ' )) {
104+ if (!str_contains ($ value , '[SIGNATURE] ' )) {
122105 $ sep = $ format === OutputFormat::Html ? ' ' : "\n" ;
123106 $ value = $ this ->appendContent ($ value , $ sep . '[SIGNATURE] ' );
124107 }
125108
126- if ($ this ->alwaysAddUserTrack && $ format === OutputFormat::Html && !strpos ($ value , '[USERTRACK] ' )) {
109+ if ($ this ->alwaysAddUserTrack && $ format === OutputFormat::Html && !str_contains ($ value , '[USERTRACK] ' )) {
127110 $ value = $ this ->appendContent ($ value , '[USERTRACK] ' );
128111 }
129112
130113 return $ value ;
131114 }
115+
116+ private function appendContent (string $ message , string $ append ): string
117+ {
118+ if (preg_match ('#</body>#i ' , $ message )) {
119+ $ message = preg_replace ('#</body>#i ' , $ append . '</body> ' , $ message );
120+ } else {
121+ $ message .= $ append ;
122+ }
123+
124+ return $ message ;
125+ }
132126}
0 commit comments