Loading src/UnicaenRenderer/Service/Macro/MacroService.php +19 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,16 @@ class MacroService return $result; } public function getMacrosAsOptions() : array { $macros = $this->getMacros(); $options = []; foreach ($macros as $macro) { $options[$macro->getId()] = $macro->getCode(); } return $options; } public function getMacro(?int $id): ?Macro { $qb = $this->createQueryBuilder() Loading Loading @@ -143,4 +153,13 @@ class MacroService return json_encode($array, JSON_HEX_APOS | JSON_HEX_QUOT); } public function evaluateMacro(Macro $macro, array $variables): string { $variable = $variables[$macro->getVariable()]??null; if ($variable === null) return ""; if (!method_exists($variable, $macro->getMethode())) return ""; return $variable->{$macro->getMethode()}(); } } No newline at end of file Loading
src/UnicaenRenderer/Service/Macro/MacroService.php +19 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,16 @@ class MacroService return $result; } public function getMacrosAsOptions() : array { $macros = $this->getMacros(); $options = []; foreach ($macros as $macro) { $options[$macro->getId()] = $macro->getCode(); } return $options; } public function getMacro(?int $id): ?Macro { $qb = $this->createQueryBuilder() Loading Loading @@ -143,4 +153,13 @@ class MacroService return json_encode($array, JSON_HEX_APOS | JSON_HEX_QUOT); } public function evaluateMacro(Macro $macro, array $variables): string { $variable = $variables[$macro->getVariable()]??null; if ($variable === null) return ""; if (!method_exists($variable, $macro->getMethode())) return ""; return $variable->{$macro->getMethode()}(); } } No newline at end of file