Skip to content

Commit

Permalink
[PageFlow] changed the way to check whether the current state is an e…
Browse files Browse the repository at this point in the history
…nd state or not (Issue piece#4)
  • Loading branch information
iteman committed Aug 12, 2013
1 parent 7c12eb5 commit fbc6272
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
18 changes: 2 additions & 16 deletions src/Piece/Flow/PageFlow/PageFlow.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ class PageFlow implements PageFlowInterface
*/
protected $attributes;

/**
* @var array
*/
protected $endStates = array();

protected $receivedValidEvent;

/**
Expand Down Expand Up @@ -115,7 +110,6 @@ public function __sleep()
'fsm',
'views',
'attributes',
'endStates',
);
}

Expand All @@ -138,15 +132,6 @@ public function setFSM(StateMachine $fsm)
$this->fsm = $fsm;
}

/**
* @param string $stateID
* @since Method available since Release 2.0.0
*/
public function addEndState($stateID)
{
$this->endStates[] = $stateID;
}

/**
* @since Method available since Release 2.0.0
*/
Expand Down Expand Up @@ -201,7 +186,8 @@ public function triggerEvent($eventID)
$this->receivedValidEvent = !is_null($this->fsm->getCurrentState()->getEvent($eventID));

$this->fsm->triggerEvent($eventID, false);
if (in_array($this->fsm->getCurrentState()->getStateID(), $this->endStates)) {

if ($this->fsm->getCurrentState()->isEndState()) {
$this->fsm->triggerEvent(PageFlowInterface::EVENT_END);
}

Expand Down
1 change: 0 additions & 1 deletion src/Piece/Flow/PageFlow/PageFlowGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ public function generate()
$this->fsmBuilder->setEndState($definition['lastState']['name'], PageFlowInterface::EVENT_END, $this->wrapAction($definition['final']));
}
$this->configureViewState($definition['lastState']);
$this->pageFlow->addEndState($definition['lastState']['name']);
$this->pageFlow->addView($definition['lastState']['name'], $definition['lastState']['view']);
}

Expand Down

0 comments on commit fbc6272

Please sign in to comment.