| Conditions | 3 |
| Paths | 4 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | public function setVar(string $variableName, string $value, bool $quoteValue=true) : Mailcode_Commands_Command_SetVariable |
||
| 24 | { |
||
| 25 | $variableName = $this->instantiator->filterVariableName($variableName); |
||
| 26 | |||
| 27 | if($quoteValue) |
||
| 28 | { |
||
| 29 | $value = $this->instantiator->quoteString($value); |
||
| 30 | } |
||
| 31 | |||
| 32 | $params = $variableName.' = '.$value; |
||
| 33 | |||
| 34 | $cmd = Mailcode::create()->getCommands()->createCommand( |
||
| 35 | 'SetVariable', |
||
| 36 | '', // type |
||
| 37 | $params, |
||
| 38 | '{setvar: '.$params.'}' |
||
| 39 | ); |
||
| 40 | |||
| 41 | $this->instantiator->checkCommand($cmd); |
||
| 42 | |||
| 43 | if($cmd instanceof Mailcode_Commands_Command_SetVariable) |
||
| 44 | { |
||
| 45 | return $cmd; |
||
| 46 | } |
||
| 47 | |||
| 48 | throw $this->instantiator->exceptionUnexpectedType('SetVariable', $cmd); |
||
| 49 | } |
||
| 51 |