Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
renderer
Commits
48a3f457
Commit
48a3f457
authored
Nov 26, 2021
by
Jean-Philippe Metivier
Browse files
Correction signature de fonction + recussion du remplacement de macro
parent
b94b3323
Pipeline
#11627
passed with stage
in 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenRenderer/Service/Rendu/RenduService.php
View file @
48a3f457
...
...
@@ -145,12 +145,14 @@ class RenduService {
* @param array $variables
* @return Rendu
*/
public
function
gener
e
ateRenduByTemplateCode
(
string
$code
,
array
$variables
)
:
Rendu
public
function
generateRenduByTemplateCode
(
string
$code
,
array
$variables
)
:
Rendu
{
$template
=
$this
->
getTemplateService
()
->
getTemplateByCode
(
$code
);
if
(
$template
===
null
)
throw
new
RuntimeException
(
'Aucun template de trouvé avec le code ['
.
$code
.
']'
);
$rendu
=
$this
->
generateRenduByTemplate
(
$template
,
$variables
);
//todo faire mieux pour rappliquer
$rendu
->
setCorps
(
$this
->
getTemplateService
()
->
replaceMacros
(
$rendu
->
getCorps
(),
$variables
));
return
$rendu
;
}
}
src/UnicaenRenderer/Service/Template/TemplateService.php
View file @
48a3f457
...
...
@@ -149,7 +149,7 @@ class TemplateService {
* @param array $variables
* @return string
*/
p
rivate
function
replaceMacros
(
string
$texteInitial
,
array
$variables
)
:
string
p
ublic
function
replaceMacros
(
string
$texteInitial
,
array
$variables
)
:
string
{
$matches
=
[];
preg_match_all
(
'/VAR\[[a-zA-Z0-9_]*#[a-zA-Z0-9_]*\]/'
,
$texteInitial
,
$matches
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment