Test Failed
Push — master ( 2f238b...3de10f )
by Adelar
02:48
created

OfxMovement::getAmount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types = 1);
3
namespace Adelarcubs\OFXParser;
4
5
use SimpleXMLElement;
6
use DateTime;
7
8
/**
9
 *
10
 * @author Adelar Tiemann Junior <[email protected]>
11
 */
12
class OfxMovement
13
{
14
15
    private $type;
16
17
    private $document;
18
19
    private $description;
20
21
    private $amount;
22 5
23
    private $dueDate;
24 5
25 5
    public function __construct(SimpleXMLElement $xml)
26 5
    {
27 5
        $this->type = (string) $xml->TRNTYPE;
28 5
        $this->document = (string) $xml->FITID;
29
        $this->description = (string) $xml->MEMO;
30 1
        $this->amount = (float) str_replace(',', '.', $xml->TRNAMT);
31
        $this->dueDate = new DateTime(substr($xml->DTPOSTED, 0, 8));
32 1
    }
33
34
    public function getType(): string
35 1
    {
36
        return $this->type;
37 1
    }
38
39
    public function getDocument(): string
40 1
    {
41
        return $this->document;
42 1
    }
43
44
    public function getDescription(): string
45 1
    {
46
        return $this->description;
47 1
    }
48
49
    public function getAmount(): float
50
    {
51
        return $this->amount;
52
    }
53
54
    public function getDueDate(): DateTime
55
    {
56
        return $this->dueDate;
57
    }
58
}
59