Completed
Push — master ( cb517e...d88e38 )
by Adelar
02:26
created

OfxMovement   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getDocument() 0 4 1
A getDescription() 0 4 1
A getAmount() 0 4 1
A getDueDate() 0 4 1
1
<?php
2
namespace Adelarcubs\OFXParser;
3
4
use SimpleXMLElement;
5
use DateTime;
6
7
/**
8
 *
9
 * @author Adelar Tiemann Junior <[email protected]>
10
 */
11
class OfxMovement
12
{
13
14
    private $document;
15
16
    private $description;
17
18
    private $amount;
19
20
    private $dueDate;
21
22 5
    public function __construct(SimpleXMLElement $xml)
23
    {
24 5
        $this->document = $xml->FITID;
0 ignored issues
show
Bug introduced by
The property FITID does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
25 5
        $this->description = $xml->MEMO;
0 ignored issues
show
Bug introduced by
The property MEMO does not seem to exist in SimpleXMLElement.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
26 5
        $this->amount = (float) str_replace(',', '.', $xml->TRNAMT);
27 5
        $this->dueDate = new DateTime(substr($xml->DTPOSTED, 0, 8));
28 5
    }
29
30 1
    public function getDocument()
31
    {
32 1
        return $this->document;
33
    }
34
35 1
    public function getDescription()
36
    {
37 1
        return $this->description;
38
    }
39
40 1
    public function getAmount()
41
    {
42 1
        return $this->amount;
43
    }
44
45 1
    public function getDueDate()
46
    {
47 1
        return $this->dueDate;
48
    }
49
}
50