Adds possibility to add parameters to actions.

This commit is contained in:
Vassyli
2017-06-12 14:58:40 +02:00
parent bbc960fd3d
commit 29e474b9c1
4 changed files with 105 additions and 2 deletions
+23 -2
View File
@@ -11,15 +11,18 @@ class Action
{
protected $id;
protected $destinationSceneId;
protected $parameters = [];
/**
* Construct a new action with the specified Scene as its destination.
* @param int $destinationSceneId
* @param array $parameters
*/
public function __construct(int $destinationSceneId)
public function __construct(int $destinationSceneId, array $parameters = [])
{
$this->id = bin2hex(random_bytes(8));
$this->destinationSceneId = $destinationSceneId;
$this->parameters = $parameters;
}
/**
@@ -35,10 +38,28 @@ class Action
/**
* Return the database ID of the destination scene, where the user will
* go if they take this action.
* @return string
* @return int
*/
public function getDestinationSceneId(): int
{
return $this->destinationSceneId;
}
/**
* Returns all parameters for this action
* @return array
*/
public function getParameters(): array
{
return $this->parameters;
}
/**
* Sets all parameters for this action
* @param array $parameters
*/
public function setParameters(array $parameters): void
{
$this->parameters = $parameters;
}
}