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

IntentNextAction   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 0
dl 0
loc 50
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A createFromArray() 0 9 1
A useStripeSDK() 0 4 1
A getRedirectToUrl() 0 4 1
A getType() 0 4 1
A getUseStripeSDK() 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
use Shapin\Stripe\Model\CreatableFromArray;
13
14
final class IntentNextAction implements CreatableFromArray
15
{
16
    const TYPE_REDIRECT_TO_URL = 'redirect_to_url';
17
    const TYPE_USE_STRIPE_SDK = 'use_stripe_sdk';
18
19
    /**
20
     * @var ?array
21
     */
22
    private $redirectToUrl;
23
24
    /**
25
     * @var string
26
     */
27
    private $type;
28
29
    /**
30
     * @var ?array
31
     */
32
    private $useStripeSDK;
33
34
    public static function createFromArray(array $data): self
35
    {
36
        $model = new self();
37
        $model->redirectToUrl = $data['redirect_to_url'] ?? null;
38
        $model->type = $data['type'];
39
        $model->useStripeSDK = $data['use_stripe_sdk'] ?? null;
40
41
        return $model;
42
    }
43
44
    public function useStripeSDK(): bool
45
    {
46
        return self::TYPE_USE_STRIPE_SDK === $this->type;
47
    }
48
49
    public function getRedirectToUrl(): ?array
50
    {
51
        return $this->redirectToUrl;
52
    }
53
54
    public function getType(): string
55
    {
56
        return $this->type;
57
    }
58
59
    public function getUseStripeSDK(): ?array
60
    {
61
        return $this->useStripeSDK;
62
    }
63
}
64