IntentNextAction::useStripeSDK()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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
final class IntentNextAction implements CreatableFromArray
13
{
14
    const TYPE_REDIRECT_TO_URL = 'redirect_to_url';
15
    const TYPE_USE_STRIPE_SDK = 'use_stripe_sdk';
16
17
    /**
18
     * @var ?array
19
     */
20
    private $redirectToUrl;
21
22
    /**
23
     * @var string
24
     */
25
    private $type;
26
27
    /**
28
     * @var ?array
29
     */
30
    private $useStripeSDK;
31
32
    public static function createFromArray(array $data): self
33
    {
34
        $model = new self();
35
        $model->redirectToUrl = $data['redirect_to_url'] ?? null;
36
        $model->type = $data['type'];
37
        $model->useStripeSDK = $data['use_stripe_sdk'] ?? null;
38
39
        return $model;
40
    }
41
42
    public function useStripeSDK(): bool
43
    {
44
        return self::TYPE_USE_STRIPE_SDK === $this->type;
45
    }
46
47
    public function getRedirectToUrl(): ?array
48
    {
49
        return $this->redirectToUrl;
50
    }
51
52
    public function getType(): string
53
    {
54
        return $this->type;
55
    }
56
57
    public function getUseStripeSDK(): ?array
58
    {
59
        return $this->useStripeSDK;
60
    }
61
}
62