1 | <?php declare(strict_types=1); |
||
23 | class CompileShell extends Shell |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * Instance of TwigView to be used to compile templates. |
||
28 | * |
||
29 | * @var TwigView |
||
30 | */ |
||
31 | protected $twigView; |
||
32 | |||
33 | /** |
||
34 | * Constructor. |
||
35 | * |
||
36 | * @param ConsoleIo $consoleIo An IO instance. |
||
37 | */ |
||
38 | 1 | public function __construct(ConsoleIo $consoleIo = null) |
|
44 | |||
45 | /** |
||
46 | * Set TwigView. |
||
47 | * |
||
48 | * @param TwigView $twigView TwigView instance. |
||
49 | * |
||
50 | */ |
||
51 | public function setTwigview(TwigView $twigView) |
||
55 | |||
56 | /** |
||
57 | * Compile all templates. |
||
58 | * |
||
59 | */ |
||
60 | public function all() |
||
69 | |||
70 | /** |
||
71 | * Compile only this plugin. |
||
72 | * |
||
73 | * @param string $plugin Plugin name. |
||
74 | * |
||
75 | */ |
||
76 | 1 | public function plugin($plugin) |
|
81 | |||
82 | /** |
||
83 | * Only compile one file. |
||
84 | * |
||
85 | * @param string $fileName File to compile. |
||
86 | * |
||
87 | */ |
||
88 | 1 | public function file($fileName) |
|
89 | { |
||
90 | 1 | $this->out('<info>Compiling one template</info>'); |
|
91 | 1 | $this->compileTemplate($fileName); |
|
92 | 1 | } |
|
93 | |||
94 | /** |
||
95 | * Set options for this console. |
||
96 | * |
||
97 | * @return \Cake\Console\ConsoleOptionParser |
||
98 | */ |
||
99 | 1 | public function getOptionParser() |
|
121 | |||
122 | /** |
||
123 | * Walk over $iterator and compile all templates in it. |
||
124 | * |
||
125 | * @param mixed $iterator Iterator to walk over. |
||
126 | * |
||
127 | */ |
||
128 | protected function walkIterator($iterator) |
||
134 | |||
135 | /** |
||
136 | * Compile a template. |
||
137 | * |
||
138 | * @param string $fileName Template to compile. |
||
139 | * |
||
140 | */ |
||
141 | protected function compileTemplate($fileName) |
||
154 | } |
||
155 |