Skip to content

Commit

Permalink
[PageFlow] Renamed the IPageFlow::isFinalState() method to isInFinalS…
Browse files Browse the repository at this point in the history
…tate(). (Issue piece#4)
  • Loading branch information
iteman committed Sep 18, 2012
1 parent e7ac4c7 commit f4b4dee
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Piece/Flow/Continuation/ContinuationServer.php
Expand Up @@ -130,7 +130,7 @@ public static function shutdown()
public function clear()
{
if (!is_null($this->pageFlowInstance)) {
if ($this->pageFlowInstance->isFinalState()) {
if ($this->pageFlowInstance->isInFinalState()) {
$this->pageFlowInstanceRepository->remove($this->pageFlowInstance);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Piece/Flow/Continuation/NullPageFlow.php
Expand Up @@ -92,7 +92,7 @@ public function getView()
return null;
}

public function isFinalState()
public function isInFinalState()
{
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Piece/Flow/Continuation/PageFlowInstance.php
Expand Up @@ -132,9 +132,9 @@ public function getView()
return $this->pageFlow->getView();
}

public function isFinalState()
public function isInFinalState()
{
return $this->pageFlow->isFinalState();
return $this->pageFlow->isInFinalState();
}

public function setActionInvoker(ActionInvoker $actionInvoker)
Expand Down
2 changes: 1 addition & 1 deletion src/Piece/Flow/PageFlow/IPageFlow.php
Expand Up @@ -92,7 +92,7 @@ public function getView();
*
* @return boolean
*/
public function isFinalState();
public function isInFinalState();

/**
* @param \Piece\Flow\PageFlow\ActionInvoker $actionInvoker
Expand Down
4 changes: 2 additions & 2 deletions src/Piece/Flow/PageFlow/PageFlow.php
Expand Up @@ -160,7 +160,7 @@ public function getView()
{
if (!$this->isActive()) return null;

$state = $this->isFinalState() ? $this->getPreviousState() : $this->getCurrentState();
$state = $this->isInFinalState() ? $this->getPreviousState() : $this->getCurrentState();
if (!array_key_exists($state->getID(), $this->views)) {
throw new InvalidTransitionException(sprintf('An invalid transition detected. The state [ %s ] does not have a view. Maybe the state [ %s ] is an action state. Check the definition for [ %s ].', $state->getID(), $state->getID(), $this->getID()));
}
Expand Down Expand Up @@ -234,7 +234,7 @@ public function setPayload($payload)
}
}

public function isFinalState()
public function isInFinalState()
{
$currentState = $this->getCurrentState();
if (is_null($currentState)) return false;
Expand Down
4 changes: 2 additions & 2 deletions test/Piece/Flow/PageFlow/PageFlowTest.php
Expand Up @@ -213,11 +213,11 @@ public function testCheckingWhetherCurrentStateIsFinalState()
$flow->setPayload(new \stdClass());
$flow->start();

$this->assertFalse($flow->isFinalState());
$this->assertFalse($flow->isInFinalState());

$flow->triggerEvent('go');

$this->assertTrue($flow->isFinalState());
$this->assertTrue($flow->isInFinalState());
}

/**
Expand Down

0 comments on commit f4b4dee

Please sign in to comment.