-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bank.php
46 lines (38 loc) · 1.18 KB
/
Bank.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
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace akryll;
use akryll\Document;
class Bank {
protected $documents;
function __construct($fileaddr) {
$maas = file($fileaddr);
$documents = [];
$docid = 0;
foreach ($maas as $key => $value) {
$value2 = rtrim($value);
$value2 = mb_convert_encoding($value2, "utf-8", "windows-1251");
$result = explode('=', $value2);
if (count($result) == 2) {
if ($result[0] == 'СекцияДокумент') {
$workflow = new Document();
}
if (isset($workflow)) {
$workflow->set($result[0], $result[1]);
}
} else {
if ($result[0] == 'КонецДокумента') {
$documents[$docid] = $workflow;
$docid++;
}
}
}
$this->documents = $documents;
}
function getDocs() {
return $this->documents;
}
}