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
![]() |
|||
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 |