1: <?php
2:
3:
4: namespace BeerXML\Generator;
5:
6:
7: class Yeast extends Record
8: {
9: protected $tagName = 'YEAST';
10:
11: 12: 13:
14: protected $record;
15:
16: 17: 18: 19: 20:
21: protected $simpleValues = array(
22: 'NAME' => 'getName',
23: 'VERSION' => 'getVersion',
24: 'TYPE' => 'getType',
25: 'FORM' => 'getForm',
26: 'AMOUNT' => 'getAmount',
27: );
28:
29: 30: 31: 32: 33:
34: protected $optionalSimpleValues = array(
35: 'AMOUNT_IS_WEIGHT' => 'getAmountIsWeight',
36: 'LABORATORY' => 'getLaboratory',
37: 'PRODUCT_ID' => 'getProductId',
38: 'MIN_TEMPERATURE' => 'getMinTemperature',
39: 'FLOCCULATION' => 'getFlocculation',
40: 'ATTENUATION' => 'getAttenuation',
41: 'NOTES' => 'getNotes',
42: 'BEST_FOR' => 'getBestFor',
43: 'TIMES_CULTURED' => 'getTimesCultured',
44: 'MAX_REUSE' => 'getMaxReuse',
45: 'MAX_TEMPERATURE' => 'getMaxTemperature',
46: 'ADD_TO_SECONDARY' => 'getAddToSecondary',
47: );
48:
49: protected $displayInterface = 'BeerXML\Generator\IYeastDisplay';
50:
51: protected $displayValues = array(
52: 'DISPLAY_AMOUNT' => 'getDisplayAmount',
53: 'DISP_MIN_TEMP' => 'getDispMinTemp',
54: 'DISP_MAX_TEMP' => 'getDispMaxTemp',
55: 'INVENTORY' => 'getInventory',
56: 'CULTURE_DATE' => 'getCultureDate',
57: );
58:
59:
60: 61: 62:
63: protected function additionalFields()
64: {
65: $amountIsWeight = $this->record->getAmountIsWeight();
66: if (!is_null($amountIsWeight)) {
67: $this->xmlWriter->writeElement('AMOUNT_IS_WEIGHT', $this->boolToString($amountIsWeight));
68: }
69:
70: $addToSecondary = $this->record->getAddToSecondary();
71: if (!is_null($addToSecondary)) {
72: $this->xmlWriter->writeElement('ADD_TO_SECONDARY', $this->boolToString($addToSecondary));
73: }
74:
75: if ($this->record instanceof $this->displayInterface) {
76: $cultureDate = $this->record->getCultureDate();
77: if ($cultureDate instanceof \DateTime) {
78: $this->xmlWriter->writeElement('CULTURE_DATE', $cultureDate->format('d M y'));
79: }
80: }
81:
82: parent::additionalFields();
83: }
84: }