Completed
Push — feature/EVO-7278-tracking-info... ( d73a1e )
by
unknown
63:38
created

ExceptionActivityListener   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 28
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onKernelException() 0 5 1
1
<?php
2
namespace Graviton\AuditTrackingBundle\Listener;
3
4
use Graviton\AuditTrackingBundle\Manager\ActivityManager;
5
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
6
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
7
use Symfony\Component\HttpKernel\HttpKernel;
8
9
/**
10
 * Class DBActivityListener
11
 * @package Graviton\AuditTrackingBundle\Listener
12
 */
13
class ExceptionActivityListener
14
{
15
    /** @var ActivityManager $manager */
16
    private $manager;
17
18
    /**
19
     * RequestActivityListener constructor.
20
     * @param ActivityManager $activityManager Business logic
21
     */
22
    public function __construct(ActivityManager $activityManager)
23
    {
24
        $this->manager = $activityManager;
25
    }
26
27
    /**
28
     * Should not handle Validation Exceptions and only service exceptions
29
     *
30
     * @param GetResponseForExceptionEvent $event Sf Event
31
     *
32
     * @return void
33
     */
34
    public function onKernelException(GetResponseForExceptionEvent $event)
35
    {
36
        $exception = $event->getException();
37
        $this->manager->registerExceptionEvent($exception);
38
    }
39
40
}