| Conditions | 4 |
| Paths | 8 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4.0582 |
| Changes | 0 | ||
| 1 | <?php |
||
| 38 | 5 | public function bake($template, $content = '', $outputFile = null) |
|
| 39 | { |
||
| 40 | 5 | if ($outputFile === null) { |
|
| 41 | 4 | $outputFile = $template; |
|
| 42 | } |
||
| 43 | 5 | if ($content === true) { |
|
| 44 | 5 | $content = $this->getContent($template); |
|
| 45 | } |
||
| 46 | 5 | if (empty($content)) { |
|
| 47 | $this->err("<warning>No generated content for '{$template}.ctp', not generating template.</warning>"); |
||
| 48 | |||
| 49 | return false; |
||
| 50 | } |
||
| 51 | 5 | $this->out("\n" . sprintf('Baking `%s` view twig template file...', $outputFile), 1, Shell::QUIET); |
|
| 52 | 5 | $path = $this->getPath(); |
|
| 53 | 5 | $filename = $path . Inflector::underscore($outputFile) . '.twig'; |
|
| 54 | 5 | $this->createFile($filename, $content); |
|
| 55 | |||
| 56 | 5 | return $content; |
|
| 57 | } |
||
| 58 | } |
||
| 59 |