Skip to content

Commit

Permalink
Merge pull request #29 from formapro/token-context
Browse files Browse the repository at this point in the history
Token Context History
  • Loading branch information
makasim authored Apr 9, 2019
2 parents ce53125 + f674b57 commit a304206
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function setProcess(Process $process)
public function addTransition(TokenTransition $transition)
{
$transition->setProcess($this->getProcess());
$transition->setContext($this->getContext());

add_object($this, 'transitions', $transition);

Expand Down Expand Up @@ -108,4 +109,14 @@ public function getFrom(): Node
{
return $this->getCurrentTransition()->getTransition()->getFrom();
}

public function setContext(?array $context): void
{
set_value($this, 'context', $context);
}

public function getContext(): ?array
{
return get_value($this, 'context');
}
}
10 changes: 10 additions & 0 deletions src/TokenTransition.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,16 @@ private function setState($state)
set_value($this, 'state', $state);
}

public function setContext(?array $context): void
{
set_value($this, 'context', $context);
}

public function getContext(): ?array
{
return get_value($this, 'context');
}

public static function createFor(Transition $transition, int $weight): TokenTransition
{
$tokenTransition = static::create();
Expand Down

0 comments on commit a304206

Please sign in to comment.