AbstractFile::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace MidasSoft\DominicanBankParser\Files;
4
5
use MidasSoft\DominicanBankParser\Exceptions\InvalidArgumentException;
6
7
abstract class AbstractFile
8
{
9
    /**
10
     * The content of the file.
11
     *
12
     * @var string
13
     */
14
    protected $fileContent;
15
16
    /**
17
     * Creates a new file.
18
     *
19
     * @param string $fileContent
20
     *
21
     * @throws \MidasSoft\DominicanBankParser\Exceptions\InvalidArgumentException
22
     */
23 13
    public function __construct($fileContent)
24
    {
25 13
        if (!is_string($fileContent)) {
0 ignored issues
show
introduced by
The condition is_string($fileContent) is always true.
Loading history...
26 1
            throw new InvalidArgumentException('You have to pass a string as the file content.');
27
        }
28
29 12
        $this->fileContent = $fileContent;
30 12
    }
31
32
    /**
33
     * Returns the array representation
34
     * of the file.
35
     *
36
     * @return array
37
     */
38
    abstract public function toArray();
39
}
40