*/ class Parameter extends TokenLiteral implements ICloudformationNative { /** * Name of the referenced parameter. * @var string */ protected $name; /** * New parameter. * @string $name * @param string $name */ public function __construct(string $name) { $this->name = $name; } /** * Get the name of the parameter. * * @return string */ public function getName(): string { return $this->name; } public static function isToken(string $stream): bool { return (bool)preg_match('/^[A-Za-z]$/', $stream[0]); } public static function getToken(string &$stream): Token { $buffer = ''; $buffer = $stream[0]; for ($i = 1; $i < strlen($stream); $i++) { if (preg_match('/^[A-Za-z0-9]$/', $stream[$i])) { $buffer .= $stream[$i]; } else { break; } } $stream = substr($stream, strlen($buffer)); return new Parameter($buffer); } /** * Get the value of this token. * * @param ?\App\Util\GraphNode[] $arguments * @return \App\Util\GraphNode|Token|scalar|null */ public function execute(?array $arguments = null) { throw new \Exception('Unreplaced parameter'); } /** * Return the cloudformation representation of a reference to a parameter. * * @param ?\App\Util\GraphNode[] $arguments * @return mixed[] */ public function toCloudformation(?array $arguments = null): array { return ['Ref' => $this->getName()]; } }