CustomerController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 41
ccs 10
cts 10
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createdAction() 0 6 1
A changedAction() 0 6 1
A deletedAction() 0 6 1
1
<?php
2
3
namespace Speicher210\FastbillBundle\Controller\Notification;
4
5
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerChangedNotification;
6
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerCreatedNotification;
7
use Speicher210\Fastbill\Api\Model\Notification\Customer\CustomerDeletedNotification;
8
use Speicher210\FastbillBundle\Event\CustomerChangedEvent;
9
use Speicher210\FastbillBundle\Event\CustomerCreatedEvent;
10
use Speicher210\FastbillBundle\Event\CustomerDeletedEvent;
11
use Symfony\Component\HttpFoundation\Request;
12
use Symfony\Component\HttpFoundation\Response;
13
14
/**
15
 * Controller for customers notifications.
16
 */
17
class CustomerController extends AbstractController
18
{
19
    /**
20
     * Action when a customer is created.
21
     *
22
     * @param Request $request The made request.
23
     * @return Response
24
     */
25 3
    public function createdAction(Request $request)
26
    {
27 3
        $event = new CustomerCreatedEvent();
28
29 3
        return $this->handleNotification($request, $event, CustomerCreatedNotification::class);
30
    }
31
32
    /**
33
     * Action when a customer is changed.
34
     *
35
     * @param Request $request The made request.
36
     * @return Response
37
     */
38 3
    public function changedAction(Request $request)
39
    {
40 3
        $event = new CustomerChangedEvent();
41
42 3
        return $this->handleNotification($request, $event, CustomerChangedNotification::class);
43 3
    }
44
45
    /**
46
     * Action when a customer is changed.
47
     *
48
     * @param Request $request The made request.
49
     * @return Response
50
     */
51 3
    public function deletedAction(Request $request)
52
    {
53 3
        $event = new CustomerDeletedEvent();
54
55 3
        return $this->handleNotification($request, $event, CustomerDeletedNotification::class);
56
    }
57
}
58