1: <?php
2:
3:
4: namespace BeerXML\Record;
5:
6:
7: use BeerXML\Generator\IFermentableDisplay as FermentableGetter;
8: use BeerXML\Parser\IFermentableDisplay as FermentableSetter;
9:
10: class Fermentable implements FermentableGetter, FermentableSetter
11: {
12:
13: const TYPE_GRAIN = 'Grain';
14: const TYPE_SUGAR = 'Sugar';
15: const TYPE_EXTRACT = 'Extract';
16: const TYPE_DRY_EXTRACT = 'Dry Extract';
17: const TYPE_ADJUNCT = 'Adjunct';
18:
19: /**
20: * @var string
21: */
22: private $name;
23:
24: /**
25: * @var int
26: */
27: private $version = 1;
28:
29: /**
30: * @var string "Grain", "Sugar", "Extract", "Dry Extract" or "Adjunct"
31: */
32: private $type;
33:
34: /**
35: * @var number Weight (kg)
36: */
37: private $amount;
38:
39: /**
40: * @var number Percent
41: */
42: private $yield;
43:
44: /**
45: * @var float (Lovibond, or SRM for liquid extract)
46: */
47: private $color;
48:
49: /**
50: * @var bool
51: */
52: private $addAfterBoil = false;
53:
54: /**
55: * @var string
56: */
57: private $origin;
58:
59: /**
60: * @var string
61: */
62: private $supplier;
63:
64: /**
65: * @var string
66: */
67: private $notes;
68:
69: /**
70: * @var number Percent
71: */
72: private $coarseFineDiff;
73:
74: /**
75: * @var number Percent
76: */
77: private $moisture;
78:
79: /**
80: * @var float Lintner
81: */
82: private $diastaticPower;
83:
84: /**
85: * @var number Percent
86: */
87: private $protein;
88:
89: /**
90: * @var number Percent
91: */
92: private $maxInBatch;
93:
94: /**
95: * @var bool
96: */
97: private $recommendMash = false;
98:
99: /**
100: * @var float
101: */
102: private $ibuGalPerLb;
103:
104: /** Fields from Appendix A Optional Extensions for BeerXML Display **/
105:
106: /**
107: * @var string
108: */
109: private $displayAmount;
110:
111: /**
112: * @var float
113: */
114: private $potential;
115:
116: /**
117: * @var string
118: */
119: private $inventory;
120:
121: /**
122: * @var string
123: */
124: private $displayColor;
125:
126: /**
127: * May be TRUE if this item is normally added after the boil. The default value is FALSE since most grains are
128: * added during the mash or boil.
129: *
130: * @param boolean $addAfterBoil
131: */
132: public function setAddAfterBoil($addAfterBoil)
133: {
134: $this->addAfterBoil = $addAfterBoil;
135: }
136:
137: /**
138: * May be TRUE if this item is normally added after the boil. The default value is FALSE since most grains are
139: * added during the mash or boil.
140: *
141: * @return boolean
142: */
143: public function getAddAfterBoil()
144: {
145: return $this->addAfterBoil;
146: }
147:
148: /**
149: * Weight of the fermentable, extract or sugar in Kilograms.
150: *
151: * @param number $amount
152: */
153: public function setAmount($amount)
154: {
155: $this->amount = $amount;
156: }
157:
158: /**
159: * Weight of the fermentable, extract or sugar in Kilograms.
160: *
161: * @return number
162: */
163: public function getAmount()
164: {
165: return $this->amount;
166: }
167:
168: /**
169: * Percent difference between the coarse grain yield and fine grain yield.
170: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
171: *
172: * @param number $coarseFineDiff
173: */
174: public function setCoarseFineDiff($coarseFineDiff)
175: {
176: $this->coarseFineDiff = $coarseFineDiff;
177: }
178:
179: /**
180: * Percent difference between the coarse grain yield and fine grain yield.
181: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
182: *
183: * @return number
184: */
185: public function getCoarseFineDiff()
186: {
187: return $this->coarseFineDiff;
188: }
189:
190: /**
191: * The color of the item in Lovibond Units (SRM for liquid extracts).
192: *
193: * @param float $color
194: */
195: public function setColor($color)
196: {
197: $this->color = $color;
198: }
199:
200: /**
201: * The color of the item in Lovibond Units (SRM for liquid extracts).
202: *
203: * @return float
204: */
205: public function getColor()
206: {
207: return $this->color;
208: }
209:
210: /**
211: * The diastatic power of the grain as measured in "Lintner" units.
212: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
213: *
214: * @param float $diastaticPower
215: */
216: public function setDiastaticPower($diastaticPower)
217: {
218: $this->diastaticPower = $diastaticPower;
219: }
220:
221: /**
222: * The diastatic power of the grain as measured in "Lintner" units.
223: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
224: *
225: * @return float
226: */
227: public function getDiastaticPower()
228: {
229: return $this->diastaticPower;
230: }
231:
232: /**
233: * For hopped extracts only - an estimate of the number of IBUs per pound of extract in a gallon of water.
234: * To convert to IBUs we multiply this number by the "AMOUNT" field (in pounds) and divide by the number of gallons
235: * in the batch. Based on a sixty minute boil.
236: * Only suitable for use with an "Extract" type, otherwise this value is ignored.
237: *
238: * @param float $ibuGalPerLb
239: */
240: public function setIbuGalPerLb($ibuGalPerLb)
241: {
242: $this->ibuGalPerLb = $ibuGalPerLb;
243: }
244:
245: /**
246: * For hopped extracts only - an estimate of the number of IBUs per pound of extract in a gallon of water.
247: * To convert to IBUs we multiply this number by the "AMOUNT" field (in pounds) and divide by the number of gallons
248: * in the batch. Based on a sixty minute boil.
249: * Only suitable for use with an "Extract" type, otherwise this value is ignored.
250: *
251: * @return float
252: */
253: public function getIbuGalPerLb()
254: {
255: return $this->ibuGalPerLb;
256: }
257:
258: /**
259: * The recommended maximum percentage (by weight) this ingredient should represent in a batch of beer.
260: *
261: * @param number $maxInBatch
262: */
263: public function setMaxInBatch($maxInBatch)
264: {
265: $this->maxInBatch = $maxInBatch;
266: }
267:
268: /**
269: * The recommended maximum percentage (by weight) this ingredient should represent in a batch of beer.
270: *
271: * @return number
272: */
273: public function getMaxInBatch()
274: {
275: return $this->maxInBatch;
276: }
277:
278: /**
279: * Percent moisture in the grain.
280: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
281: *
282: * @param number $moisture
283: */
284: public function setMoisture($moisture)
285: {
286: $this->moisture = $moisture;
287: }
288:
289: /**
290: * Percent moisture in the grain.
291: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
292: *
293: * @return number
294: */
295: public function getMoisture()
296: {
297: return $this->moisture;
298: }
299:
300: /**
301: * Name of the fermentable.
302: *
303: * @param string $name
304: */
305: public function setName($name)
306: {
307: $this->name = $name;
308: }
309:
310: /**
311: * Name of the fermentable.
312: *
313: * @return string
314: */
315: public function getName()
316: {
317: return $this->name;
318: }
319:
320: /**
321: * Textual noted describing this ingredient and its use. May be multiline.
322: *
323: * @param string $notes
324: */
325: public function setNotes($notes)
326: {
327: $this->notes = $notes;
328: }
329:
330: /**
331: * Textual noted describing this ingredient and its use. May be multiline.
332: *
333: * @return string
334: */
335: public function getNotes()
336: {
337: return $this->notes;
338: }
339:
340: /**
341: * Country or place of origin
342: *
343: * @param string $origin
344: */
345: public function setOrigin($origin)
346: {
347: $this->origin = $origin;
348: }
349:
350: /**
351: * Country or place of origin
352: *
353: * @return string
354: */
355: public function getOrigin()
356: {
357: return $this->origin;
358: }
359:
360: /**
361: * The percent protein in the grain.
362: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
363: *
364: * @param number $protein
365: */
366: public function setProtein($protein)
367: {
368: $this->protein = $protein;
369: }
370:
371: /**
372: * The percent protein in the grain.
373: * Only appropriate for a "Grain" or "Adjunct" type, otherwise this value is ignored.
374: *
375: * @return number
376: */
377: public function getProtein()
378: {
379: return $this->protein;
380: }
381:
382: /**
383: * TRUE if it is recommended the grain be mashed, FALSE if it can be steeped.
384: * A value of TRUE is only appropriate for a "Grain" or "Adjunct" types. The default value is FALSE.
385: * Note that this does NOT indicate whether the grain is mashed or not – it is only a recommendation used in recipe
386: * formulation.
387: *
388: * @param boolean $recommendMash
389: */
390: public function setRecommendMash($recommendMash)
391: {
392: $this->recommendMash = $recommendMash;
393: }
394:
395: /**
396: * TRUE if it is recommended the grain be mashed, FALSE if it can be steeped.
397: * A value of TRUE is only appropriate for a "Grain" or "Adjunct" types. The default value is FALSE.
398: * Note that this does NOT indicate whether the grain is mashed or not – it is only a recommendation used in recipe
399: * formulation.
400: *
401: * @return boolean
402: */
403: public function getRecommendMash()
404: {
405: return $this->recommendMash;
406: }
407:
408: /**
409: * Supplier of the grain/extract/sugar
410: *
411: * @param string $supplier
412: */
413: public function setSupplier($supplier)
414: {
415: $this->supplier = $supplier;
416: }
417:
418: /**
419: * Supplier of the grain/extract/sugar
420: *
421: * @return string
422: */
423: public function getSupplier()
424: {
425: return $this->supplier;
426: }
427:
428: /**
429: * May be "Grain", "Sugar", "Extract", "Dry Extract" or "Adjunct". Extract refers to liquid extract.
430: *
431: * @param string $type
432: */
433: public function setType($type)
434: {
435: $this->type = $type;
436: }
437:
438: /**
439: * May be "Grain", "Sugar", "Extract", "Dry Extract" or "Adjunct". Extract refers to liquid extract.
440: *
441: * @return string
442: */
443: public function getType()
444: {
445: return $this->type;
446: }
447:
448: /**
449: * Should be set to 1 for this version of the XML standard.
450: * May be a higher number for later versions but all later versions shall be backward compatible.
451: *
452: * @param int $version
453: */
454: public function setVersion($version)
455: {
456: $this->version = $version;
457: }
458:
459: /**
460: * Should be set to 1 for this version of the XML standard.
461: * May be a higher number for later versions but all later versions shall be backward compatible.
462: *
463: * @return int
464: */
465: public function getVersion()
466: {
467: return $this->version;
468: }
469:
470: /**
471: * Percent dry yield (fine grain) for the grain, or the raw yield by weight if this is an extract adjunct or sugar.
472: *
473: * @param number $yield
474: */
475: public function setYield($yield)
476: {
477: $this->yield = $yield;
478: }
479:
480: /**
481: * Percent dry yield (fine grain) for the grain, or the raw yield by weight if this is an extract adjunct or sugar.
482: *
483: * @return number
484: */
485: public function getYield()
486: {
487: return $this->yield;
488: }
489:
490: /**
491: * The amount of fermentables in this record along with the units formatted for easy display in the current user
492: * defined units. For example "1.5 lbs" or "2.1 kg".
493: *
494: * @param string $displayAmount
495: */
496: public function setDisplayAmount($displayAmount)
497: {
498: $this->displayAmount = $displayAmount;
499: }
500:
501: /**
502: * The amount of fermentables in this record along with the units formatted for easy display in the current user
503: * defined units. For example "1.5 lbs" or "2.1 kg".
504: *
505: * @return string
506: */
507: public function getDisplayAmount()
508: {
509: return $this->displayAmount;
510: }
511:
512: /**
513: * Color in user defined color units along with the unit identified – for example "200L" or "40 ebc"
514: *
515: * @param string $displayColor
516: */
517: public function setDisplayColor($displayColor)
518: {
519: $this->displayColor = $displayColor;
520: }
521:
522: /**
523: * Color in user defined color units along with the unit identified – for example "200L" or "40 ebc"
524: *
525: * @return string
526: */
527: public function getDisplayColor()
528: {
529: return $this->displayColor;
530: }
531:
532: /**
533: * Amount in inventory for this item along with the units – for example "10.0 lb"
534: *
535: * @param string $inventory
536: */
537: public function setInventory($inventory)
538: {
539: $this->inventory = $inventory;
540: }
541:
542: /**
543: * Amount in inventory for this item along with the units – for example "10.0 lb"
544: *
545: * @return string
546: */
547: public function getInventory()
548: {
549: return $this->inventory;
550: }
551:
552: /**
553: * The yield of the fermentable converted to specific gravity units for display. For example "1.036" or "1.040"
554: * might be valid potentials.
555: *
556: * @param float $potential
557: */
558: public function setPotential($potential)
559: {
560: $this->potential = $potential;
561: }
562:
563: /**
564: * The yield of the fermentable converted to specific gravity units for display. For example "1.036" or "1.040"
565: * might be valid potentials.
566: *
567: * @return float
568: */
569: public function getPotential()
570: {
571: return $this->potential;
572: }
573:
574:
575:
576: }
577: