Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | public function create(string $snippetName, string $namespace = null): Mailcode_Commands_Command_ShowSnippet |
||
28 | { |
||
29 | $snippetName = $this->instantiator->filterVariableName($snippetName); |
||
30 | $paramsString = $this->compileParams($namespace); |
||
31 | |||
32 | $cmd = $this->commands->createCommand( |
||
33 | 'ShowSnippet', |
||
34 | '', |
||
35 | $snippetName . $paramsString, |
||
36 | sprintf('{showsnippet: %s%s', |
||
37 | $snippetName, |
||
38 | $paramsString) |
||
39 | ); |
||
40 | |||
41 | $this->instantiator->checkCommand($cmd); |
||
42 | |||
43 | if ($cmd instanceof Mailcode_Commands_Command_ShowSnippet) { |
||
44 | return $cmd; |
||
45 | } |
||
46 | |||
47 | throw $this->instantiator->exceptionUnexpectedType('ShowSnippet', $cmd); |
||
48 | } |
||
68 |