Completed
Push — master ( 77d576...27d56a )
by Bram
07:37
created

TicketPayment   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A onCaptured() 0 7 3
1
<?php
2
3
namespace Broarm\EventTickets;
4
5
use DataExtension;
6
use SilverStripe\Omnipay\Service\ServiceResponse;
7
8
/**
9
 * Class TicketPayment
10
 *
11
 * @author Bram de Leeuw
12
 * @property TicketPayment|\Payment $owner
13
 *
14
 * @property int                    ReservationID
15
 */
16
class TicketPayment extends DataExtension
17
{
18
    private static $has_one = array(
0 ignored issues
show
Unused Code introduced by
The property $has_one is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
19
        'Reservation' => 'Broarm\EventTickets\Reservation',
20
    );
21
22
    /**
23
     * Complete the order on a successful transaction
24
     *
25
     * @param ServiceResponse $response
26
     *
27
     * @throws \ValidationException
28
     */
29
    public function onCaptured(ServiceResponse $response)
0 ignored issues
show
Unused Code introduced by
The parameter $response is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
30
    {
31
        /** @var Reservation $reservation */
32
        if (($reservation = Reservation::get()->byID($this->owner->ReservationID)) && $reservation->exists()) {
33
            $reservation->complete();
34
        }
35
    }
36
}
37