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

OfxMovement   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 1 Features 0
Metric Value
wmc 6
c 3
b 1
f 0
lcom 0
cbo 0
dl 0
loc 47
ccs 14
cts 14
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getType() 0 4 1
A getDocument() 0 4 1
A getDescription() 0 4 1
A getAmount() 0 4 1
A getDueDate() 0 4 1
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