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

BaseParser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 5
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 5
cbo 1
dl 0
loc 28
ccs 0
cts 20
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A extractType() 0 4 1
A extractDocument() 0 4 1
A extractDescription() 0 4 1
A extractAmount() 0 4 1
A extractDueDate() 0 4 1
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