# Class LightnCandy

LightnCandy major static class

  LightnCandy\Flags
  LightnCandy\LightnCandy

Namespace: LightnCandy
Located at LightnCandy.php

Methods summary
`public static string|false` | # `compile( string $template, array<string,array|string|integer> $options = array('flags' => self::FLAG_BESTPERFORMANCE) )` Compile handlebars template into PHP code. Compile handlebars template into PHP code. #### Parameters $template handlebars template string $options LightnCandy compile time and run time options, default is array('flags' => LightnCandy::FLAG_BESTPERFORMANCE) #### Returns string|false Compiled PHP code when successed. If error happened and compile failed, return false.
`public static string|false` | # `compilePartial( string $template, array<string,array|string|integer> $options = array('flags' => self::FLAG_BESTPERFORMANCE) )` Compile handlebars partial into PHP function code. Compile handlebars partial into PHP function code. #### Parameters $template handlebars template string $options LightnCandy compile time and run time options, default is array('flags' => LightnCandy::FLAG_BESTPERFORMANCE) #### Returns string|false Compiled PHP code when successed. If error happened and compile failed, return false. #### Expect false when input '{{"}}', array('flags' => LightnCandy::FLAG_HANDLEBARS)
`protected static boolean` | # `handleError( array<string,array|string|integer> & $context )` Handle exists error and return error status. Handle exists error and return error status. #### Parameters $context Current context of compiler progress. #### Returns boolean True when error detected #### Throws Exception #### Expect false when input array('error' => array()) true when input array('error' => array('some error'), 'flags' => array('errorlog' => 0, 'exception' => 0))
`public static array<string,array|string|integer>` | # `getContext( )` Get last compiler context. Get last compiler context. #### Returns array<string,array|string|integer> Context data
`public static Closure|false` | # `prepare( string $php, string|null $tmpDir = null, boolean $delete = true )` 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. 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. #### Deprecated #### Parameters $php PHP code $tmpDir Optional, change temp directory for php include file saved by prepare() when cannot include PHP code with data:// format. $delete Optional, delete temp php file when set to tru. Default is true, set it to false for debug propose #### Returns Closure|false result of include()

Constants inherited from LightnCandy\Flags
`FLAG_ADVARNAME, FLAG_BESTPERFORMANCE, FLAG_ECHO, FLAG_ELSE, FLAG_ERROR_EXCEPTION, FLAG_ERROR_LOG, FLAG_ERROR_SKIPPARTIAL, FLAG_EXTHELPER, FLAG_HANDLEBARS, FLAG_HANDLEBARSJS, FLAG_HANDLEBARSJS_FULL, FLAG_HANDLEBARSLAMBDA, FLAG_HBESCAPE, FLAG_IGNORESTANDALONE, FLAG_INSTANCE, FLAG_JS, FLAG_JSLENGTH, FLAG_JSOBJECT, FLAG_JSTRUE, FLAG_KNOWNHELPERSONLY, FLAG_METHOD, FLAG_MUSTACHE, FLAG_MUSTACHELAMBDA, FLAG_MUSTACHELOOKUP, FLAG_MUSTACHESECTION, FLAG_NAMEDARG, FLAG_NOESCAPE, FLAG_NOHBHELPERS, FLAG_PARENT, FLAG_PARTIALNEWCONTEXT, FLAG_PREVENTINDENT, FLAG_PROPERTY, FLAG_RAWBLOCK, FLAG_RENDER_DEBUG, FLAG_RUNTIMEPARTIAL, FLAG_SLASH, FLAG_SPVARS, FLAG_STANDALONEPHP, FLAG_STRINGPARAMS, FLAG_THIS`

Properties summary
`protected static` | $lastContext | # ``
`public static` | $lastParsed | # ``