コード例 #1
0
 /**
  * parse and add rules to transition specification
  *
  * @param array $transitionDescription
  */
 protected function addRulesToTransitionSpecification($transitionDescription)
 {
     if (array_key_exists('rules', $transitionDescription)) {
         $rules = RulesFactory::createBatchByShortNames($transitionDescription['rules']);
         $this->getTransitionSpecification()->setRules($rules);
     }
 }
コード例 #2
0
 public function testCreateBatchByShortNames()
 {
     $factory = new RulesFactory();
     $rules = $factory->createBatchByShortNames(['alwaysTrue', 'alwaysFalse']);
     $this->assertCount(2, $rules, 'contains only 2 rule');
     $this->assertContainsOnlyInstancesOf(IRule::class, $rules, 'contains only Rules');
 }
コード例 #3
0
 /**
  * Создать Property содержащее правила
  *
  * @param $name
  * @param $rules
  * @return Property
  */
 protected static function createLeafProperty($name, $rules)
 {
     $property = new Property($name);
     $property->setRules(RulesFactory::createBatchByShortNames($rules));
     return $property;
 }