-
Notifications
You must be signed in to change notification settings - Fork 7
/
simple.php
60 lines (52 loc) · 1.52 KB
/
simple.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
declare(strict_types=1);
use SIE\Data\Account;
use SIE\Data\Company;
use SIE\Data\Transaction;
use SIE\Data\Verification;
use SIE\Data\VerificationSeries;
use SIE\Dumper\SIEDumper;
/**
* This file is part of the SIE-PHP package.
*
* (c) Johan Wilfer <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
// Autoload files using Composer autoload
require_once __DIR__ . '/../vendor/autoload.php';
// create a company
$company = (new Company())
// set company name
->setCompanyName('My company')
// add a verification series
->addVerificationSeries(new VerificationSeries())
;
// add two accounts
$account1511 = (new Account(1511))->setName('Kundfordringar');
$account3741 = (new Account(3741))->setName('Öresutjämning');
$company
->addAccount($account1511)
->addAccount($account3741)
;
// add a verification with two transactions
$verification = (new Verification('591000490'))->setDate('20150105')
->addTransaction(
(new Transaction())
->setAccount($account1511)
->setAmount(-0.24)
)
->addTransaction(
(new Transaction())
->setAccount($account3741)
->setAmount(0.24)
)
;
// add the verification to the company
$company->getVerificationSeriesAll()[0]->addVerification($verification);
// validate data, will throw Exception if invalid data
$company->validate();
$dumper = new SIEDumper();
$output = $dumper->dump($company);
echo $output;