1 | <?php |
||
25 | class LightnCandy extends Flags |
||
26 | { |
||
27 | protected static $lastContext; |
||
28 | public static $lastParsed; |
||
29 | |||
30 | /** |
||
31 | * Compile handlebars template into PHP code. |
||
32 | * |
||
33 | * @param string $template handlebars template string |
||
34 | * @param array<string,array|string|integer> $options LightnCandy compile time and run time options, default is array('flags' => LightnCandy::FLAG_BESTPERFORMANCE) |
||
35 | * |
||
36 | * @return string|false Compiled PHP code when successed. If error happened and compile failed, return false. |
||
37 | */ |
||
38 | 797 | public static function compile($template, $options = array('flags' => self::FLAG_BESTPERFORMANCE)) |
|
57 | |||
58 | /** |
||
59 | * Compile handlebars partial into PHP function code. |
||
60 | * |
||
61 | * @param string $template handlebars template string |
||
62 | * @param array<string,array|string|integer> $options LightnCandy compile time and run time options, default is array('flags' => LightnCandy::FLAG_BESTPERFORMANCE) |
||
63 | * |
||
64 | * @return string|false Compiled PHP code when successed. If error happened and compile failed, return false. |
||
65 | * |
||
66 | * @expect false when input '{{"}}', array('flags' => LightnCandy::FLAG_HANDLEBARS) |
||
67 | */ |
||
68 | 1 | public static function compilePartial($template, $options = array('flags' => self::FLAG_BESTPERFORMANCE)) |
|
87 | |||
88 | /** |
||
89 | * Handle exists error and return error status. |
||
90 | * |
||
91 | * @param array<string,array|string|integer> $context Current context of compiler progress. |
||
92 | * |
||
93 | * @throws \Exception |
||
94 | * @return boolean True when error detected |
||
95 | * |
||
96 | * @expect false when input array('error' => array()) |
||
97 | * @expect true when input array('error' => array('some error'), 'flags' => array('errorlog' => 0, 'exception' => 0)) |
||
98 | */ |
||
99 | 798 | protected static function handleError(&$context) |
|
114 | |||
115 | /** |
||
116 | * Get last compiler context. |
||
117 | * |
||
118 | * @return array<string,array|string|integer> Context data |
||
119 | */ |
||
120 | 286 | public static function getContext() |
|
124 | |||
125 | /** |
||
126 | * Get a working render function by a string of PHP code. This method may requires php setting allow_url_include=1 and allow_url_fopen=1 , or access right to tmp file system. |
||
127 | * |
||
128 | * @param string $php PHP code |
||
129 | * @param string|null $tmpDir Optional, change temp directory for php include file saved by prepare() when cannot include PHP code with data:// format. |
||
130 | * @param boolean $delete Optional, delete temp php file when set to tru. Default is true, set it to false for debug propose |
||
131 | * |
||
132 | * @return Closure|false result of include() |
||
133 | * |
||
134 | * @deprecated |
||
135 | */ |
||
136 | 686 | public static function prepare($php, $tmpDir = null, $delete = true) |
|
168 | } |
||
169 |