SubscriptionController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 1
Metric Value
wmc 5
c 2
b 0
f 1
lcom 1
cbo 6
dl 0
loc 67
ccs 15
cts 15
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createdAction() 0 6 1
A changedAction() 0 6 1
A canceledAction() 0 6 1
A closedAction() 0 6 1
A reactivatedAction() 0 6 1
1
<?php
2
3
namespace Speicher210\FastbillBundle\Controller\Notification;
4
5
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionCanceledNotification;
6
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionChangedNotification;
7
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionClosedNotification;
8
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionCreatedNotification;
9
use Speicher210\Fastbill\Api\Model\Notification\Subscription\SubscriptionReactivatedNotification;
10
use Speicher210\FastbillBundle\Event\SubscriptionCanceledEvent;
11
use Speicher210\FastbillBundle\Event\SubscriptionChangedEvent;
12
use Speicher210\FastbillBundle\Event\SubscriptionClosedEvent;
13
use Speicher210\FastbillBundle\Event\SubscriptionCreatedEvent;
14
use Speicher210\FastbillBundle\Event\SubscriptionReactivatedEvent;
15
use Symfony\Component\HttpFoundation\Request;
16
use Symfony\Component\HttpFoundation\Response;
17
18
/**
19
 * Controller for subscriptions notifications.
20
 */
21
class SubscriptionController extends AbstractController
22
{
23
    /**
24
     * Action when a subscription is created.
25
     *
26
     * @param Request $request The made request.
27
     * @return Response
28
     */
29 21
    public function createdAction(Request $request)
30
    {
31 21
        $event = new SubscriptionCreatedEvent();
32
33 21
        return $this->handleNotification($request, $event, SubscriptionCreatedNotification::class);
34
    }
35
36
    /**
37
     * Action when a subscription is changed.
38
     *
39
     * @param Request $request The made request.
40
     * @return Response
41
     */
42 3
    public function changedAction(Request $request)
43
    {
44 3
        $event = new SubscriptionChangedEvent();
45
46 3
        return $this->handleNotification($request, $event, SubscriptionChangedNotification::class);
47
    }
48
49
    /**
50
     * Action when a subscription is canceled.
51
     *
52
     * @param Request $request The made request.
53
     * @return Response
54
     */
55 3
    public function canceledAction(Request $request)
56
    {
57 3
        $event = new SubscriptionCanceledEvent();
58
59 3
        return $this->handleNotification($request, $event, SubscriptionCanceledNotification::class);
60
    }
61
62
    /**
63
     * Action when a subscription is closed.
64
     *
65
     * @param Request $request The made request.
66
     * @return Response
67
     */
68 3
    public function closedAction(Request $request)
69
    {
70 3
        $event = new SubscriptionClosedEvent();
71
72 3
        return $this->handleNotification($request, $event, SubscriptionClosedNotification::class);
73
    }
74
75
    /**
76
     * Action when a subscription is reactivated.
77
     *
78
     * @param Request $request The made request.
79
     * @return Response
80
     */
81 3
    public function reactivatedAction(Request $request)
82
    {
83 3
        $event = new SubscriptionReactivatedEvent();
84
85 3
        return $this->handleNotification($request, $event, SubscriptionReactivatedNotification::class);
86
    }
87
}
88