Overview

Namespaces

  • BeerXML
    • Exception
    • Generator
    • Parser
    • Record
  • PHP

Classes

  • Equipment
  • Fermentable
  • Hop
  • MashProfile
  • MashStep
  • Misc
  • Recipe
  • Record
  • RecordFactory
  • Style
  • Water
  • Yeast

Interfaces

  • IEquipment
  • IEquipmentDisplay
  • IFermentable
  • IFermentableDisplay
  • IHop
  • IHopDisplay
  • IMashProfile
  • IMashProfileDisplay
  • IMashStep
  • IMashStepDisplay
  • IMisc
  • IMiscDisplay
  • IRecipe
  • IRecipeDisplay
  • IStyle
  • IStyleDisplay
  • IWater
  • IWaterDisplay
  • IYeast
  • IYeastDisplay
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: 
 4: namespace BeerXML\Parser;
 5: 
 6: 
 7: class Fermentable extends Record
 8: {
 9:     protected $tagName = 'FERMENTABLE';
10: 
11:     /**
12:      * Tags that map to simple values and the corresponding setter method on the record class
13:      *
14:      * @var array
15:      */
16:     protected $simpleProperties = array(
17:         'NAME'             => 'setName',
18:         'VERSION'          => 'setVersion',
19:         'TYPE'             => 'setType',
20:         'AMOUNT'           => 'setAmount',
21:         'YIELD'            => 'setYield',
22:         'COLOR'            => 'setColor',
23:         'ORIGIN'           => 'setOrigin',
24:         'SUPPLIER'         => 'setSupplier',
25:         'NOTES'            => 'setNotes',
26:         'COARSE_FINE_DIFF' => 'setCoarseFineDiff',
27:         'MOISTURE'         => 'setMoisture',
28:         'DIASTATIC_POWER'  => 'setDiastaticPower',
29:         'PROTEIN'          => 'setProtein',
30:         'MAX_IN_BATCH'     => 'setMaxInBatch',
31:         'IBU_GAL_PER_LB'   => 'setIbuGalPerLb',
32:     );
33: 
34:     /**
35:      * @return IFermentable
36:      */
37:     public function createRecord()
38:     {
39:         $fermentable = $this->recordFactory->getFermentable();
40:         if ($fermentable instanceof IFermentableDisplay) {
41:             $this->simpleProperties = array_merge(
42:                 $this->simpleProperties,
43:                 array(
44:                     'DISPLAY_AMOUNT' => 'setDisplayAmount',
45:                     'POTENTIAL'      => 'setPotential',
46:                     'INVENTORY'      => 'setInventory',
47:                     'DISPLAY_COLOR'  => 'setDisplayColor',
48:                 )
49:             );
50:         }
51:         return $fermentable;
52:     }
53: 
54:     /**
55:      * @param IFermentable $record
56:      */
57:     protected function otherElementEncountered($record)
58:     {
59:         if ('ADD_AFTER_BOIL' == $this->xmlReader->name) {
60:             $value = ($this->xmlReader->readString() == 'TRUE');
61:             $record->setAddAfterBoil($value);
62:         }
63:         if ('RECOMMEND_MASH' == $this->xmlReader->name) {
64:             $value = ($this->xmlReader->readString() == 'TRUE');
65:             $record->setRecommendMash($value);
66:         }
67:     }
68: }
69: 
php-beerxml API documentation generated by ApiGen 2.8.0