Metabor\Statemachine\Transition::setWeight PHP Method

setWeight() public method

public setWeight ( float $weight )
$weight float
    public function setWeight($weight)
    {
        $this->weight = $weight;
    }

Usage Example

 /**
  *
  */
 public function testThrowsAnExceptionIfMoreThanOneTransitionHasHighestWeight()
 {
     $targetState = new State('TargetState');
     $transitions = array();
     $transition = new Transition($targetState);
     $transition->setWeight(0.001);
     $transitions[] = $transition;
     $transition = new Transition($targetState);
     $transition->setWeight(0.001);
     $transitions[] = $transition;
     $selector = new WeightTransition();
     $this->setExpectedException('\\RuntimeException');
     $selector->selectTransition(new \ArrayIterator($transitions));
 }
All Usage Examples Of Metabor\Statemachine\Transition::setWeight