1: <?php
2:
3:
4: namespace BeerXML\Parser;
5:
6:
7: class Yeast extends Record
8: {
9: protected $tagName = 'YEAST';
10:
11: 12: 13: 14: 15:
16: protected $simpleProperties = array(
17: 'NAME' => 'setName',
18: 'VERSION' => 'setVersion',
19: 'TYPE' => 'setType',
20: 'FORM' => 'setForm',
21: 'AMOUNT' => 'setAmount',
22: 'LABORATORY' => 'setLaboratory',
23: 'PRODUCT_ID' => 'setProductId',
24: 'MIN_TEMPERATURE' => 'setMinTemperature',
25: 'FLOCCULATION' => 'setFlocculation',
26: 'ATTENUATION' => 'setAttenuation',
27: 'NOTES' => 'setNotes',
28: 'BEST_FOR' => 'setBestFor',
29: 'TIMES_CULTURED' => 'setTimesCultured',
30: 'MAX_REUSE' => 'setMaxReuse',
31: 'MAX_TEMPERATURE' => 'setMaxTemperature',
32: );
33:
34: 35: 36:
37: protected function createRecord()
38: {
39: $yeast = $this->recordFactory->getYeast();
40: if ($yeast instanceof IYeastDisplay) {
41: $this->simpleProperties = array_merge(
42: $this->simpleProperties,
43: array(
44: 'DISPLAY_AMOUNT' => 'setDisplayAmount',
45: 'DISP_MIN_TEMP' => 'setDispMinTemp',
46: 'DISP_MAX_TEMP' => 'setDispMaxTemp',
47: 'INVENTORY' => 'setInventory',
48: )
49: );
50: }
51: return $yeast;
52: }
53:
54: 55: 56:
57: protected function otherElementEncountered($record)
58: {
59: if ('AMOUNT_IS_WEIGHT' == $this->xmlReader->name) {
60: $value = ($this->xmlReader->readString() == 'TRUE');
61: $record->setAmountIsWeight($value);
62: } elseif ('ADD_TO_SECONDARY' == $this->xmlReader->name) {
63: $value = ($this->xmlReader->readString() == 'TRUE');
64: $record->setAddToSecondary($value);
65: } elseif ('CULTURE_DATE' == $this->xmlReader->name && $record instanceof IYeastDisplay) {
66: $date = new \DateTime($this->xmlReader->readString());
67: $record->setCultureDate($date);
68: }
69: }
70: }
71: