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 Misc extends Record
 8: {
 9:     protected $tagName = 'MISC';
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:         'USE'     => 'setUse',
21:         'TIME'    => 'setTime',
22:         'AMOUNT'  => 'setAmount',
23:         'USE_FOR' => 'setUseFor',
24:         'NOTES'   => 'setNotes',
25:     );
26: 
27:     /**
28:      * @return IMisc
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:      * @param IMisc $record
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: 
php-beerxml API documentation generated by ApiGen 2.8.0