Conditions | 3 |
Paths | 4 |
Total Lines | 32 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function create(string $variableName, string $formatString="") : Mailcode_Commands_Command_ShowDate |
||
27 | { |
||
28 | $variableName = $this->instantiator->filterVariableName($variableName); |
||
29 | |||
30 | $format = ''; |
||
31 | if(!empty($formatString)) |
||
32 | { |
||
33 | $format = sprintf( |
||
34 | ' "%s"', |
||
35 | $formatString |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | $cmd = $this->commands->createCommand( |
||
40 | 'ShowDate', |
||
41 | '', |
||
42 | $variableName.$format, |
||
43 | sprintf( |
||
44 | '{showdate: %s%s}', |
||
45 | $variableName, |
||
46 | $format |
||
47 | ) |
||
48 | ); |
||
49 | |||
50 | $this->instantiator->checkCommand($cmd); |
||
51 | |||
52 | if($cmd instanceof Mailcode_Commands_Command_ShowDate) |
||
53 | { |
||
54 | return $cmd; |
||
55 | } |
||
56 | |||
57 | throw $this->instantiator->exceptionUnexpectedType('ShowDate', $cmd); |
||
58 | } |
||
60 |