Completed
Push — master ( abb491...352f9f )
by Olivier
01:38
created

Intent   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 40%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 45
ccs 4
cts 10
cp 0.4
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A requiresAction() 0 4 1
A requiresPaymentMethod() 0 4 1
A isSucceeded() 0 4 1
A getNextAction() 0 4 1
A getStatus() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Model;
11
12
abstract class Intent
13
{
14
    const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
15
    const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
16
    const STATUS_REQUIRES_ACTION = 'requires_action';
17
    const STATUS_PROCESSING = 'processing';
18
    const STATUS_REQUIRES_CAPTURE = 'requires_capture';
19
    const STATUS_CANCELED = 'canceled';
20
    const STATUS_SUCCEEDED = 'succeeded';
21
22
    /**
23
     * @var ?IntentNextAction
24
     */
25
    protected $nextAction;
26
27
    /**
28
     * @var string
29
     */
30
    protected $status;
31
32
    public function requiresAction(): bool
33
    {
34
        return self::STATUS_REQUIRES_ACTION === $this->status;
35
    }
36
37
    public function requiresPaymentMethod(): bool
38
    {
39
        return self::STATUS_REQUIRES_PAYMENT_METHOD === $this->status;
40
    }
41
42
    public function isSucceeded()
43
    {
44
        return self::STATUS_SUCCEEDED === $this->status;
45
    }
46
47 2
    public function getNextAction(): ?IntentNextAction
48
    {
49 2
        return $this->nextAction;
50
    }
51
52 2
    public function getStatus(): string
53
    {
54 2
        return $this->status;
55
    }
56
}
57