Adds possibility to add parameters to actions.
This commit is contained in:
+23
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user