Passed
Push — master ( 623e87...a3cc8b )
by Gabriel
03:03
created

CompletePurchaseResponse::isCancelled()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
ccs 0
cts 6
cp 0
cc 3
nc 3
nop 0
crap 12
1
<?php
2
3
namespace ByTIC\Payments\Gateways\Providers\Paylike\Message;
4
5
use ByTIC\Omnipay\Paylike\Message\CompletePurchaseResponse as AbstractCompletePurchaseResponse;
6
use ByTIC\Payments\Gateways\Providers\AbstractGateway\Message\Traits\CompletePurchaseResponseTrait;
7
8
/**
9
 * Class CompletePurchaseResponse
10
 * @package ByTIC\Payments\Gateways\Providers\Paylike\Message
11
 */
12
class CompletePurchaseResponse extends AbstractCompletePurchaseResponse
13
{
14
    use CompletePurchaseResponseTrait;
15
16
    /**
17
     * @inheritDoc
18
     */
19
    public function isPending()
20
    {
21
        $model = $this->getModel();
22
        if ($model) {
23
            if (empty($model->status) or $model->status === 'pending') {
0 ignored issues
show
Bug introduced by
The property status does not exist on ByTIC\Common\Payments\Mo...IsPurchasableModelTrait. Did you mean status_notes?
Loading history...
24
                return true;
25
            }
26
        }
27
        return parent::isPending();
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function isCancelled()
34
    {
35
        $model = $this->getModel();
36
        if ($model) {
37
            if ($model->status === 'canceled') {
0 ignored issues
show
Bug introduced by
The property status does not exist on ByTIC\Common\Payments\Mo...IsPurchasableModelTrait. Did you mean status_notes?
Loading history...
38
                return true;
39
            }
40
        }
41
        return parent::isCancelled();
42
    }
43
44
    /**
45
     * @inheritDoc
46
     */
47
    public function isSuccessful()
48
    {
49
        $model = $this->getModel();
50
        if ($model) {
51
            if ($model->status === 'active') {
0 ignored issues
show
Bug introduced by
The property status does not exist on ByTIC\Common\Payments\Mo...IsPurchasableModelTrait. Did you mean status_notes?
Loading history...
52
                return true;
53
            }
54
        }
55
        return parent::isSuccessful();
56
    }
57
58
    /** @noinspection PhpMissingParentCallCommonInspection
59
     * @return bool
60
     */
61
    protected function canProcessModel()
62
    {
63
        return true;
64
    }
65
}
66