Completed
Push — master ( bfa16e...cb517e )
by Adelar
02:07
created

OfxMovement   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 42.86%

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 6
cts 14
cp 0.4286
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 4
    public function __construct(SimpleXMLElement $xml)
23
    {
24 4
        $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 4
        $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 4
        $this->amount = (float) str_replace(',', '.', $xml->TRNAMT);
27 4
        $this->dueDate = new DateTime(substr($xml->DTPOSTED, 0, 8));
28 4
    }
29
30
    public function getDocument()
31
    {
32
        return $this->document;
33
    }
34
35
    public function getDescription()
36
    {
37
        return $this->description;
38
    }
39
40
    public function getAmount()
41
    {
42
        return $this->amount;
43
    }
44
45
    public function getDueDate()
46
    {
47
        return $this->dueDate;
48
    }
49
}
50