1: <?php
2:
3:
4: namespace BeerXML\Parser;
5:
6:
7: class Misc extends Record
8: {
9: protected $tagName = 'MISC';
10:
11: 12: 13: 14: 15:
16: protected $simpleProperties = array(
17: 'NAME' => 'setName',
18: 'VERSION' => 'setVersion',
19: 'TYPE' => 'setType',
20: 'USE' => 'setUse',
21: 'TIME' => 'setTime',
22: 'AMOUNT' => 'setAmount',
23: 'USE_FOR' => 'setUseFor',
24: 'NOTES' => 'setNotes',
25: );
26:
27: 28: 29:
30: protected function createRecord()
31: {
32: $misc = $this->recordFactory->getMisc();
33: if ($misc instanceof IMiscDisplay) {
34: $this->simpleProperties = array_merge(
35: $this->simpleProperties,
36: array(
37: 'DISPLAY_AMOUNT' => 'setDisplayAmount',
38: 'INVENTORY' => 'setInventory',
39: 'DISPLAY_TIME' => 'setDisplayTime',
40: )
41: );
42: }
43: return $misc;
44: }
45:
46: 47: 48:
49: protected function otherElementEncountered($record)
50: {
51: if ('AMOUNT_IS_WEIGHT' == $this->xmlReader->name) {
52: $value = ($this->xmlReader->readString() == 'TRUE');
53: $record->setAmountIsWeight($value);
54: }
55: }
56: }
57: