Completed
Push — master ( ad55a4...c98fe8 )
by Joachim
01:57
created

Form   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 80
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 8 1
A getShopOrderId() 0 4 1
A getAmount() 0 4 1
A getCurrency() 0 4 1
A getLanguage() 0 4 1
A isEmbeddedWindow() 0 4 1
1
<?php
2
3
namespace Loevgaard\AltaPay\Callback;
4
5
class Form extends Callback
6
{
7
    /**
8
     * @var string
9
     */
10
    protected $shopOrderId;
11
12
    /**
13
     * @var float
14
     */
15
    protected $amount;
16
17
    /**
18
     * ISO 4217 currency code
19
     *
20
     * @var int
21
     */
22
    protected $currency;
23
24
    /**
25
     * ISO 639 alpha 2 language code
26
     *
27
     * @var string
28
     */
29
    protected $language;
30
31
    /**
32
     * @var boolean
33
     */
34
    protected $embeddedWindow;
35
36
    public function init()
37
    {
38
        $this->shopOrderId = $this->body['shop_orderid'];
39
        $this->amount = (float)$this->body['amount'];
40
        $this->currency = (int)$this->body['currency'];
41
        $this->language = $this->body['language'];
42
        $this->embeddedWindow = (int)$this->body['embedded_window'] === 1;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getShopOrderId(): string
49
    {
50
        return $this->shopOrderId;
51
    }
52
53
    /**
54
     * @return float
55
     */
56
    public function getAmount(): float
57
    {
58
        return $this->amount;
59
    }
60
61
    /**
62
     * @return int
63
     */
64
    public function getCurrency(): int
65
    {
66
        return $this->currency;
67
    }
68
69
    /**
70
     * @return string
71
     */
72
    public function getLanguage(): string
73
    {
74
        return $this->language;
75
    }
76
77
    /**
78
     * @return bool
79
     */
80
    public function isEmbeddedWindow(): bool
81
    {
82
        return $this->embeddedWindow;
83
    }
84
}