Inheritance: extends AbstractModel
 /**
  *
  */
 public function testReforma()
 {
     $tagEnumerationParser = self::reformaInstance();
     $tagEnumerationParser->parse();
     $count = 0;
     foreach ($tagEnumerationParser->getGenerator()->getStructs() as $struct) {
         if ($struct instanceof Struct && $struct->getIsRestriction() === true) {
             if ($struct->getName() === 'HouseStateEnum') {
                 $values = new StructValueContainer($tagEnumerationParser->getGenerator());
                 $one = new StructValue($tagEnumerationParser->getGenerator(), '1', 0, $struct);
                 $one->setMeta(array('label' => 'normal', 'description' => 'Исправный'));
                 $values->add($one);
                 $two = new StructValue($tagEnumerationParser->getGenerator(), '2', 1, $struct);
                 $two->setMeta(array('label' => 'warning', 'description' => 'Требующий капитального ремонта'));
                 $values->add($two);
                 $three = new StructValue($tagEnumerationParser->getGenerator(), '3', 2, $struct);
                 $three->setMeta(array('label' => 'alarm', 'description' => 'Аварийный'));
                 $values->add($three);
                 $four = new StructValue($tagEnumerationParser->getGenerator(), '4', 3, $struct);
                 $four->setMeta(array('label' => 'noinfo', 'description' => 'Нет данных'));
                 $values->add($four);
                 $this->assertEquals($values, $struct->getValues());
                 $count++;
             } elseif ($struct->getName() === 'HouseStageEnum') {
                 $values = new StructValueContainer($tagEnumerationParser->getGenerator());
                 $one = new StructValue($tagEnumerationParser->getGenerator(), '1', 0, $struct);
                 $one->setMeta(array('label' => 'exploited', 'description' => 'Эксплуатируемый'));
                 $values->add($one);
                 $two = new StructValue($tagEnumerationParser->getGenerator(), '2', 1, $struct);
                 $two->setMeta(array('label' => 'decommissioned', 'description' => 'Выведенный из эксплуатации'));
                 $values->add($two);
                 $three = new StructValue($tagEnumerationParser->getGenerator(), '3', 2, $struct);
                 $three->setMeta(array('label' => 'drifting', 'description' => 'Снесенный'));
                 $values->add($three);
                 $struct->getValues()->rewind();
                 $this->assertEquals($values, $struct->getValues());
                 $count++;
             }
         }
     }
     $this->assertSame(2, $count);
 }
 /**
  * @return StructValueContainer
  */
 public static function instance()
 {
     $struct = StructTest::instance('Foo', 'true');
     $structValueContainer = new StructValueContainer(self::getBingGeneratorInstance());
     $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 1, 0, $struct));
     $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 2, 1, $struct));
     $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'any', 2, $struct));
     $structValueContainer->add(new StructValue(self::getBingGeneratorInstance(), 'bar', 3, $struct));
     return $structValueContainer;
 }
Example #3
0
 /**
  * Gets the value object for the given value
  * @uses Struct::getValues()
  * @uses AbstractModel::getName()
  * @param string $value Value name
  * @return StructValue|null
  */
 public function getValue($value)
 {
     return $this->values->getStructValueByName($value);
 }