DoctrineDeleteEventLogger   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 3
eloc 6
dl 0
loc 25
rs 10
c 3
b 1
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getSubscribedEvents() 0 6 1
A savePendingLogs() 0 3 1
A __construct() 0 2 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