Completed
Push — master ( 0e80d1...71fba1 )
by Roni
08:02
created

DoctrineDeleteEventLogger   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 32
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A savePendingLogs() 0 4 1
A getSubscribedEvents() 0 7 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
15
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
16
use Symfony\Component\HttpKernel\KernelEvents;
17
use Xiidea\EasyAuditBundle\Logger\Logger;
18
use Symfony\Component\Console\ConsoleEvents;
19
20
class DoctrineDeleteEventLogger implements EventSubscriberInterface
21
{
22
    /**
23
     * @var Logger
24
     */
25
    private $logger;
26
27
    /**
28
     * DoctrineDeleteEventLogger constructor.
29
     * @param Logger $logger
30
     */
31
    public function __construct(Logger $logger)
32
    {
33
        $this->logger = $logger;
34
    }
35
36
    public function savePendingLogs()
37
    {
38
        $this->logger->savePendingLogs();
39
    }
40
41
    /**
42
     * @return array
43
     */
44
    public static function getSubscribedEvents()
45
    {
46
        return [
47
            ConsoleEvents::TERMINATE => 'savePendingLogs',
48
            KernelEvents::TERMINATE => 'savePendingLogs'
49
        ];
50
    }
51
}