|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace byrokrat\autogiro; |
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* Basic ag container |
|
9
|
|
|
*/ |
|
10
|
|
|
class Section |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @var string Layout identifier |
|
14
|
|
|
*/ |
|
15
|
|
|
private $layoutIdentifier; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @var Record\Record Section opening record |
|
19
|
|
|
*/ |
|
20
|
|
|
private $openingRecord; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var Record\Record Section closing record |
|
24
|
|
|
*/ |
|
25
|
|
|
private $closingRecord; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var Record\Record[] Contained records |
|
29
|
|
|
*/ |
|
30
|
|
|
private $records = []; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Set layout identifier for this section |
|
34
|
|
|
* |
|
35
|
|
|
* @see Layouts For the list of valid layout identifiers |
|
36
|
|
|
*/ |
|
37
|
6 |
|
public function __construct(string $layoutIdentifier) |
|
38
|
|
|
{ |
|
39
|
6 |
|
$this->layoutIdentifier = $layoutIdentifier; |
|
40
|
6 |
|
$this->openingRecord = new Record\NullRecord; |
|
41
|
6 |
|
$this->closingRecord = new Record\NullRecord; |
|
42
|
6 |
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get layout identifier for this section |
|
46
|
|
|
* |
|
47
|
|
|
* @see Layouts For the list of valid layout identifiers |
|
48
|
|
|
*/ |
|
49
|
1 |
|
public function getLayoutIdentifier(): string |
|
50
|
|
|
{ |
|
51
|
1 |
|
return $this->layoutIdentifier; |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Set section opening record |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public function setOpeningRecord(Record\Record $record) |
|
58
|
|
|
{ |
|
59
|
1 |
|
$this->openingRecord = $record; |
|
60
|
1 |
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Get section opening record |
|
64
|
|
|
*/ |
|
65
|
2 |
|
public function getOpeningRecord(): Record\Record |
|
66
|
|
|
{ |
|
67
|
2 |
|
return $this->openingRecord; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Set section closing record |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function setClosingRecord(Record\Record $record) |
|
74
|
|
|
{ |
|
75
|
1 |
|
$this->closingRecord = $record; |
|
76
|
1 |
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Get section closing record |
|
80
|
|
|
*/ |
|
81
|
2 |
|
public function getClosingRecord(): Record\Record |
|
82
|
|
|
{ |
|
83
|
2 |
|
return $this->closingRecord; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* Add a contained record |
|
88
|
|
|
*/ |
|
89
|
1 |
|
public function addRecord(Record\Record $record) |
|
90
|
|
|
{ |
|
91
|
1 |
|
$this->records[] = $record; |
|
92
|
1 |
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* Get contained records |
|
96
|
|
|
* |
|
97
|
|
|
* @return Record\Record[] |
|
98
|
|
|
*/ |
|
99
|
1 |
|
public function getRecords(): array |
|
100
|
|
|
{ |
|
101
|
1 |
|
return $this->records; |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|