Passed
Branch master (e17e02)
by Jacques
02:12
created

Income   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 11
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 6
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadOfx() 0 9 1
1
<?php
2
3
namespace OfxParser\Entities\Investment\Transaction;
4
5
use SimpleXMLElement;
6
use OfxParser\Entities\AbstractEntity;
7
use OfxParser\Entities\Investment;
8
use OfxParser\Entities\Investment\Transaction\Traits\IncomeType;
9
use OfxParser\Entities\Investment\Transaction\Traits\InvTran;
10
use OfxParser\Entities\Investment\Transaction\Traits\Pricing;
11
use OfxParser\Entities\Investment\Transaction\Traits\SecId;
12
13
/**
14
 * OFX 203 doc:
15
 * 13.9.2.4.3 Investment Buy/Sell Aggregates <INVBUY>/<INVSELL>
16
 *
17
 * Required:
18
 * <INVTRAN> aggregate
19
 * <SECID> aggregate
20
 * <INCOMETYPE>
21
 * <TOTAL>
22
 * <SUBACCTSEC>
23
 * <SUBACCTFUND>
24
 *
25
 * Optional:
26
 * ...many...
27
 *
28
 * Partial implementation.
29
 */
30
class Income extends Investment
31
{
32
    /**
33
     * Traits used to define properties
34
     */
35
    use IncomeType;
0 ignored issues
show
Bug introduced by
The trait OfxParser\Entities\Inves...ction\Traits\IncomeType requires the property $INCOMETYPE which is not provided by OfxParser\Entities\Investment\Transaction\Income.
Loading history...
36
    use InvTran;
0 ignored issues
show
introduced by
The trait OfxParser\Entities\Inves...nsaction\Traits\InvTran requires some properties which are not provided by OfxParser\Entities\Investment\Transaction\Income: $FITID, $DTTRADE, $DTSETTLE, $MEMO
Loading history...
37
    use Pricing; // Not all of these are required for this node
0 ignored issues
show
introduced by
The trait OfxParser\Entities\Inves...nsaction\Traits\Pricing requires some properties which are not provided by OfxParser\Entities\Investment\Transaction\Income: $UNITS, $UNITPRICE, $SUBACCTFUND, $TOTAL, $SUBACCTSEC
Loading history...
38
    use SecId;
0 ignored issues
show
introduced by
The trait OfxParser\Entities\Inves...ransaction\Traits\SecId requires some properties which are not provided by OfxParser\Entities\Investment\Transaction\Income: $UNIQUEID, $UNIQUEIDTYPE
Loading history...
39
40
    /**
41
     * @var string
42
     */
43
    public $nodeName = 'INCOME';
44
45
    /**
46
     * Imports the OFX data for this node.
47
     * @param SimpleXMLElement $node
48
     * @return $this
49
     */
50
    public function loadOfx(SimpleXMLElement $node)
51
    {
52
        // Transaction data is in the root
53
        $this->loadInvTran($node->INVTRAN)
54
            ->loadSecId($node->SECID)
55
            ->loadPricing($node)
56
            ->loadIncomeType($node);
57
58
        return $this;
59
    }
60
}
61