Completed
Push — master ( 3529b6...bfa16e )
by Adelar
02:20
created

OfxMovement::getDocument()   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 1
Bugs 0 Features 0
Metric Value
c 1
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
namespace Adelarcubs\OFXParser;
3
4
use SimpleXMLElement;
5
use Datatime;
6
7
/**
8
 *
9
 * @author Adelar Tiemann Junior <[email protected]>
10
 */
11
class OfxMovement
12
{
13
14
    private $document;
15 4
16
    private $description;
17 4
18 4
    private $amount;
19
20
    private $dueDate;
21
22
    public function __construct(SimpleXMLElement $xml)
23
    {
24
        $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
        $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
        $this->amount = (float) str_replace(',', '.', $xml->TRNAMT);
27
        $this->dueDate = new DateTime(substr($this->DTPOSTED, 0, 8));
0 ignored issues
show
Bug introduced by
The property DTPOSTED does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
28
    }
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