DoctrineDeleteEventLogger::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 0
dl 0
loc 2
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the XiideaEasyAuditBundle package.
5
 *
6
 * (c) Xiidea <http://www.xiidea.net>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Xiidea\EasyAuditBundle\Subscriber;
13
14
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
use Symfony\Component\HttpKernel\KernelEvents;
16
use Xiidea\EasyAuditBundle\Logger\Logger;
17
use Symfony\Component\Console\ConsoleEvents;
18
19
class DoctrineDeleteEventLogger implements EventSubscriberInterface
20
{
21
    /**
22
     * DoctrineDeleteEventLogger constructor.
23
     *
24
     * @param Logger $logger
25
     */
26
    public function __construct(private Logger $logger)
27
    {
28
    }
29
30
    public function savePendingLogs()
31
    {
32
        $this->logger->savePendingLogs();
33
    }
34
35
    /**
36
     * @return array
37
     */
38
    #[\Override]
39
    public static function getSubscribedEvents(): array
40
    {
41
        return [
42
            ConsoleEvents::TERMINATE => 'savePendingLogs',
43
            KernelEvents::TERMINATE => 'savePendingLogs',
44
        ];
45
    }
46
}
47