Completed
Push — master ( 83472f...6fbcb0 )
by Adelar
02:23
created

BaseParser::extractDocument()   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 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
declare(strict_types = 1);
3
namespace Adelarcubs\OFXParser\Parser;
4
5
use Adelarcubs\OFXParser\AbstractParser;
6
use DateTime;
7
8
/**
9
 *
10
 * @author Adelar Tiemann Junior <[email protected]>
11
 */
12
class BaseParser extends AbstractParser
13
{
14
15
    protected function extractType(): string
16
    {
17
        return (string) $this->type;
18
    }
19
20
    protected function extractDocument(): string
21
    {
22
        return (string) $this->document;
23
    }
24
25
    protected function extractDescription(): string
26
    {
27
        return (string) $this->description;
28
    }
29
30
    protected function extractAmount(): float
31
    {
32
        return (float) str_replace(',', '.', $this->amount);
33
    }
34
35
    protected function extractDueDate(): DateTime
36
    {
37
        return new DateTime(substr((string) $this->dueDate, 0, 8));
38
    }
39
}
40