mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-17 16:21:30 +02:00
Applied rector with PHP8.1 migration rules
This commit is contained in:
parent
dc6a67c2f0
commit
7ee01d9a05
303 changed files with 1228 additions and 3465 deletions
|
@ -28,20 +28,15 @@ use Twig\TwigFunction;
|
|||
final class LogExtension extends AbstractExtension
|
||||
{
|
||||
|
||||
private LogDataFormatter $logDataFormatter;
|
||||
private LogDiffFormatter $logDiffFormatter;
|
||||
|
||||
public function __construct(LogDataFormatter $logDataFormatter, LogDiffFormatter $logDiffFormatter)
|
||||
public function __construct(private readonly LogDataFormatter $logDataFormatter, private readonly LogDiffFormatter $logDiffFormatter)
|
||||
{
|
||||
$this->logDataFormatter = $logDataFormatter;
|
||||
$this->logDiffFormatter = $logDiffFormatter;
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction('format_log_data', [$this->logDataFormatter, 'formatData'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('format_log_diff', [$this->logDiffFormatter, 'formatDiff'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('format_log_data', fn($data, \App\Entity\LogSystem\AbstractLogEntry $logEntry, string $fieldName): string => $this->logDataFormatter->formatData($data, $logEntry, $fieldName), ['is_safe' => ['html']]),
|
||||
new TwigFunction('format_log_diff', fn($old_data, $new_data): string => $this->logDiffFormatter->formatDiff($old_data, $new_data), ['is_safe' => ['html']]),
|
||||
];
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue