|
|
@ -18,9 +18,17 @@ class CfnppOptions implements IOptions |
|
|
|
*/ |
|
|
|
protected $variables; |
|
|
|
|
|
|
|
/** |
|
|
|
* Store the parameters we send to cloudformation. |
|
|
|
* |
|
|
|
* @var array<string,mixed> |
|
|
|
*/ |
|
|
|
protected $parameters; |
|
|
|
|
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
$this->variables = []; |
|
|
|
$this->parameters = []; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -82,4 +90,64 @@ class CfnppOptions implements IOptions |
|
|
|
{ |
|
|
|
return isset($this->variables[$name]); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set all parameters. |
|
|
|
* |
|
|
|
* @param array<string,mixed> $parameters |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function setParameters(array $parameters): void |
|
|
|
{ |
|
|
|
$this->parameters = $parameters; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Retrieve all parameters. |
|
|
|
* |
|
|
|
* @return array<string,mixed> |
|
|
|
*/ |
|
|
|
public function getParameters(): array |
|
|
|
{ |
|
|
|
return $this->parameters; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Retrieve the value of a single parameter. |
|
|
|
* |
|
|
|
* @param string $name |
|
|
|
* @throws \Exception if parameter does not exist |
|
|
|
* @return mixed |
|
|
|
*/ |
|
|
|
public function getParameter(string $name) |
|
|
|
{ |
|
|
|
if (!isset($this->parameters[$name])) |
|
|
|
{ |
|
|
|
throw new \Exception('Unset parameter: '.$name); |
|
|
|
} |
|
|
|
return $this->parameters[$name]; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Set a single parameter. |
|
|
|
* |
|
|
|
* @param string $name |
|
|
|
* @param mixed $value |
|
|
|
* @return void |
|
|
|
*/ |
|
|
|
public function setParameter(string $name, $value): void |
|
|
|
{ |
|
|
|
$this->parameters[$name] = $value; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Check if a parameter exists. |
|
|
|
* |
|
|
|
* @param string $name |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
public function hasParameter(string $name): bool |
|
|
|
{ |
|
|
|
return isset($this->parameters[$name]); |
|
|
|
} |
|
|
|
} |
|
|
|