PHP 클래스 Twig_Environment, php-framework-benchmarks

저자: Fabien Potencier ([email protected])
파일 보기 프로젝트 열기: pmjones/php-framework-benchmarks 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$autoReload
$baseTemplateClass
$binaryOperators
$cache
$charset
$compiler
$debug
$extensions
$filterCallbacks
$filters
$functionCallbacks
$functions
$globals
$lexer
$loadedTemplates
$loader
$parser
$parsers
$runtimeInitialized
$strictVariables
$templateClassPrefix
$tests
$unaryOperators
$visitors

공개 메소드들

메소드 설명
__construct ( Twig_LoaderInterface $loader = null, array $options = [] ) Constructor.
__construct ( Twig_LoaderInterface $loader = null, array $options = [], Twig_LexerInterface $lexer = null, Twig_ParserInterface $parser = null, Twig_CompilerInterface $compiler = null ) Constructor.
addExtension ( Twig_ExtensionInterface $extension ) Registers an extension.
addFilter ( $name, Twig_FilterInterface $filter )
addFilter ( string $name, Twig_FilterInterface $filter ) Registers a Filter.
addFunction ( string $name, Twig_FunctionInterface $function ) Registers a Function.
addGlobal ( string $name, mixed $value ) Registers a Global.
addNodeVisitor ( Twig_NodeVisitorInterface $visitor ) Registers a Node Visitor.
addTest ( $name, Twig_TestInterface $test )
addTest ( string $name, Twig_TestInterface $test ) Registers a Test.
addTokenParser ( Twig_TokenParserInterface $parser ) Registers a Token Parser.
clearCacheFiles ( ) Clears the template cache files on the filesystem.
clearTemplateCache ( ) Clears the internal template cache.
compile ( Twig_NodeInterface $node )
compile ( Twig_NodeInterface $node ) : string Compiles a Node.
compileSource ( $source, $name )
compileSource ( string $source, string $name = null ) : string Compiles a template source code.
disableAutoReload ( ) Disables the auto_reload option.
disableDebug ( ) Disables debugging mode.
disableStrictVariables ( ) Disables the strict_variables option.
enableAutoReload ( ) Enables the auto_reload option.
enableDebug ( ) Enables debugging mode.
enableStrictVariables ( ) Enables the strict_variables option.
getBaseTemplateClass ( )
getBaseTemplateClass ( ) : string Gets the base template class for compiled templates.
getBinaryOperators ( )
getBinaryOperators ( ) : array Gets the registered binary Operators.
getCache ( )
getCache ( ) : string | false Gets the cache directory or false if cache is disabled.
getCacheFilename ( $name )
getCacheFilename ( string $name ) : string Gets the cache filename for a given template.
getCharset ( )
getCharset ( ) : string Gets the default template charset.
getCompiler ( )
getCompiler ( ) : Twig_CompilerInterface Gets the Compiler instance.
getExtension ( $name )
getExtension ( string $name ) : Twig_ExtensionInterface Gets an extension by name.
getExtensions ( )
getExtensions ( ) : array Returns all registered extensions.
getFilter ( string $name ) : Twig_Filter | false Get a filter by name.
getFilters ( )
getFunction ( string $name ) : Twig_Function | false Get a function by name.
getGlobals ( ) : array Gets the registered Globals.
getLexer ( )
getLexer ( ) : Twig_LexerInterface Gets the Lexer instance.
getLoader ( )
getLoader ( ) : Twig_LoaderInterface Gets the Loader instance.
getNodeVisitors ( )
getNodeVisitors ( ) : Twig_NodeVisitorInterface[] Gets the registered Node Visitors.
getParser ( )
getParser ( ) : Twig_ParserInterface Gets the Parser instance.
getTemplateClass ( string $name ) : string Gets the template class associated with the given string.
getTemplateClassPrefix ( ) : string Gets the template class prefix.
getTests ( )
getTests ( ) : Twig_TestInterface[] Gets the registered Tests.
getTokenParsers ( )
getTokenParsers ( ) : Twig_TokenParserInterface[] Gets the registered Token Parsers.
getUnaryOperators ( )
getUnaryOperators ( ) : array Gets the registered unary Operators.
hasExtension ( $name )
hasExtension ( string $name ) : boolean Returns true if the given extension is registered.
initRuntime ( ) Initializes the runtime environment.
isAutoReload ( )
isAutoReload ( ) : boolean Checks if the auto_reload option is enabled.
isDebug ( )
isDebug ( ) : boolean Checks if debug mode is enabled.
isStrictVariables ( )
isStrictVariables ( ) : boolean Checks if the strict_variables option is enabled.
loadTemplate ( string $name ) : Twig_TemplateInterface Loads a template by name.
parse ( Twig_TokenStream $tokens )
parse ( Twig_TokenStream $tokens ) : Twig_Node_Module Parses a token stream.
registerUndefinedFilterCallback ( $callable )
registerUndefinedFunctionCallback ( $callable )
removeExtension ( $name )
removeExtension ( string $name ) Removes an extension by name.
render ( string $name, array $context = [] ) : string Renders a template.
setAutoReload ( $autoReload )
setBaseTemplateClass ( $class )
setBaseTemplateClass ( string $class ) Sets the base template class for compiled templates.
setCache ( $cache )
setCache ( string | false $cache ) Sets the cache directory or false if cache is disabled.
setCharset ( $charset )
setCharset ( string $charset ) Sets the default template charset.
setCompiler ( Twig_CompilerInterface $compiler ) Sets the Compiler instance.
setExtensions ( array $extensions ) Registers an array of extensions.
setLexer ( Twig_LexerInterface $lexer ) Sets the Lexer instance.
setLoader ( Twig_LoaderInterface $loader ) Sets the Loader instance.
setParser ( Twig_ParserInterface $parser ) Sets the Parser instance.
tokenize ( $source, $name )
tokenize ( string $source, string $name = null ) : Twig_TokenStream Tokenizes a source code.

보호된 메소드들

메소드 설명
initOperators ( )
loadFilters ( ) : Twig_FilterInterface[] Gets the registered Filters.
loadFunctions ( )
writeCacheFile ( $file, $content )

메소드 상세

__construct() 공개 메소드

Available options: * debug: When set to true, the generated templates have a __toString() method that you can use to display the generated nodes (default to false). * charset: The charset used by the templates (default to utf-8). * base_template_class: The base template class to use for generated templates (default to Twig_Template). * cache: An absolute path where to store the compiled templates, or false to disable compilation cache (default) * auto_reload: Whether to reload the template is the original source changed. If you don't provide the auto_reload option, it will be determined automatically base on the debug value. * strict_variables: Whether to ignore invalid variables in templates (default to false). * autoescape: Whether to enable auto-escaping (default to true); * optimizations: A flag that indicates which optimizations to apply (default to -1 which means that all optimizations are enabled; set it to 0 to disable)
public __construct ( Twig_LoaderInterface $loader = null, array $options = [] )
$loader Twig_LoaderInterface A Twig_LoaderInterface instance
$options array An array of options

__construct() 공개 메소드

Available options: * debug: When set to true, the generated templates have a __toString() method that you can use to display the generated nodes (default to false). * charset: The charset used by the templates (default to utf-8). * base_template_class: The base template class to use for generated templates (default to Twig_Template). * cache: An absolute path where to store the compiled templates, or false to disable compilation cache (default) * auto_reload: Whether to reload the template is the original source changed. If you don't provide the auto_reload option, it will be determined automatically base on the debug value. * strict_variables: Whether to ignore invalid variables in templates (default to false).
public __construct ( Twig_LoaderInterface $loader = null, array $options = [], Twig_LexerInterface $lexer = null, Twig_ParserInterface $parser = null, Twig_CompilerInterface $compiler = null )
$loader Twig_LoaderInterface A Twig_LoaderInterface instance
$options array An array of options
$lexer Twig_LexerInterface A Twig_LexerInterface instance
$parser Twig_ParserInterface A Twig_ParserInterface instance
$compiler Twig_CompilerInterface A Twig_CompilerInterface instance

addExtension() 공개 메소드

Registers an extension.
public addExtension ( Twig_ExtensionInterface $extension )
$extension Twig_ExtensionInterface A Twig_ExtensionInterface instance

addFilter() 공개 메소드

public addFilter ( $name, Twig_FilterInterface $filter )
$filter Twig_FilterInterface

addFilter() 공개 메소드

Registers a Filter.
public addFilter ( string $name, Twig_FilterInterface $filter )
$name string The filter name
$filter Twig_FilterInterface

addFunction() 공개 메소드

Registers a Function.
public addFunction ( string $name, Twig_FunctionInterface $function )
$name string The function name
$function Twig_FunctionInterface A Twig_FunctionInterface instance

addGlobal() 공개 메소드

Registers a Global.
public addGlobal ( string $name, mixed $value )
$name string The global name
$value mixed The global value

addNodeVisitor() 공개 메소드

Registers a Node Visitor.
public addNodeVisitor ( Twig_NodeVisitorInterface $visitor )
$visitor Twig_NodeVisitorInterface A Twig_NodeVisitorInterface instance

addTest() 공개 메소드

public addTest ( $name, Twig_TestInterface $test )
$test Twig_TestInterface

addTest() 공개 메소드

Registers a Test.
public addTest ( string $name, Twig_TestInterface $test )
$name string The test name
$test Twig_TestInterface

addTokenParser() 공개 메소드

Registers a Token Parser.
public addTokenParser ( Twig_TokenParserInterface $parser )
$parser Twig_TokenParserInterface A Twig_TokenParserInterface instance

clearCacheFiles() 공개 메소드

Clears the template cache files on the filesystem.
public clearCacheFiles ( )

clearTemplateCache() 공개 메소드

Clears the internal template cache.
public clearTemplateCache ( )

compile() 공개 메소드

public compile ( Twig_NodeInterface $node )
$node Twig_NodeInterface

compile() 공개 메소드

Compiles a Node.
public compile ( Twig_NodeInterface $node ) : string
$node Twig_NodeInterface A Twig_NodeInterface instance
리턴 string The compiled PHP source code

compileSource() 공개 메소드

public compileSource ( $source, $name )

compileSource() 공개 메소드

Compiles a template source code.
public compileSource ( string $source, string $name = null ) : string
$source string The template source code
$name string The template name
리턴 string The compiled PHP source code

disableAutoReload() 공개 메소드

Disables the auto_reload option.
public disableAutoReload ( )

disableDebug() 공개 메소드

Disables debugging mode.
public disableDebug ( )

disableStrictVariables() 공개 메소드

Disables the strict_variables option.

enableAutoReload() 공개 메소드

Enables the auto_reload option.
public enableAutoReload ( )

enableDebug() 공개 메소드

Enables debugging mode.
public enableDebug ( )

enableStrictVariables() 공개 메소드

Enables the strict_variables option.

getBaseTemplateClass() 공개 메소드

getBaseTemplateClass() 공개 메소드

Gets the base template class for compiled templates.
public getBaseTemplateClass ( ) : string
리턴 string The base template class name

getBinaryOperators() 공개 메소드

public getBinaryOperators ( )

getBinaryOperators() 공개 메소드

Gets the registered binary Operators.
public getBinaryOperators ( ) : array
리턴 array An array of binary operators

getCache() 공개 메소드

public getCache ( )

getCache() 공개 메소드

Gets the cache directory or false if cache is disabled.
public getCache ( ) : string | false
리턴 string | false

getCacheFilename() 공개 메소드

public getCacheFilename ( $name )

getCacheFilename() 공개 메소드

Gets the cache filename for a given template.
public getCacheFilename ( string $name ) : string
$name string The template name
리턴 string The cache file name

getCharset() 공개 메소드

public getCharset ( )

getCharset() 공개 메소드

Gets the default template charset.
public getCharset ( ) : string
리턴 string The default charset

getCompiler() 공개 메소드

public getCompiler ( )

getCompiler() 공개 메소드

Gets the Compiler instance.
public getCompiler ( ) : Twig_CompilerInterface
리턴 Twig_CompilerInterface A Twig_CompilerInterface instance

getExtension() 공개 메소드

public getExtension ( $name )

getExtension() 공개 메소드

Gets an extension by name.
public getExtension ( string $name ) : Twig_ExtensionInterface
$name string The extension name
리턴 Twig_ExtensionInterface A Twig_ExtensionInterface instance

getExtensions() 공개 메소드

public getExtensions ( )

getExtensions() 공개 메소드

Returns all registered extensions.
public getExtensions ( ) : array
리턴 array An array of extensions

getFilter() 공개 메소드

Subclasses may override this method and load filters differently; so no list of filters is available.
public getFilter ( string $name ) : Twig_Filter | false
$name string The filter name
리턴 Twig_Filter | false A Twig_Filter instance or false if the filter does not exists

getFilters() 공개 메소드

public getFilters ( )

getFunction() 공개 메소드

Subclasses may override this method and load functions differently; so no list of functions is available.
public getFunction ( string $name ) : Twig_Function | false
$name string function name
리턴 Twig_Function | false A Twig_Function instance or false if the function does not exists

getGlobals() 공개 메소드

Gets the registered Globals.
public getGlobals ( ) : array
리턴 array An array of globals

getLexer() 공개 메소드

public getLexer ( )

getLexer() 공개 메소드

Gets the Lexer instance.
public getLexer ( ) : Twig_LexerInterface
리턴 Twig_LexerInterface A Twig_LexerInterface instance

getLoader() 공개 메소드

public getLoader ( )

getLoader() 공개 메소드

Gets the Loader instance.
public getLoader ( ) : Twig_LoaderInterface
리턴 Twig_LoaderInterface A Twig_LoaderInterface instance

getNodeVisitors() 공개 메소드

public getNodeVisitors ( )

getNodeVisitors() 공개 메소드

Gets the registered Node Visitors.
public getNodeVisitors ( ) : Twig_NodeVisitorInterface[]
리턴 Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances

getParser() 공개 메소드

public getParser ( )

getParser() 공개 메소드

Gets the Parser instance.
public getParser ( ) : Twig_ParserInterface
리턴 Twig_ParserInterface A Twig_ParserInterface instance

getTemplateClass() 공개 메소드

Gets the template class associated with the given string.
public getTemplateClass ( string $name ) : string
$name string The name for which to calculate the template class name
리턴 string The template class name

getTemplateClassPrefix() 공개 메소드

Gets the template class prefix.
public getTemplateClassPrefix ( ) : string
리턴 string The template class prefix

getTests() 공개 메소드

public getTests ( )

getTests() 공개 메소드

Gets the registered Tests.
public getTests ( ) : Twig_TestInterface[]
리턴 Twig_TestInterface[] An array of Twig_TestInterface instances

getTokenParsers() 공개 메소드

public getTokenParsers ( )

getTokenParsers() 공개 메소드

Gets the registered Token Parsers.
public getTokenParsers ( ) : Twig_TokenParserInterface[]
리턴 Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances

getUnaryOperators() 공개 메소드

public getUnaryOperators ( )

getUnaryOperators() 공개 메소드

Gets the registered unary Operators.
public getUnaryOperators ( ) : array
리턴 array An array of unary operators

hasExtension() 공개 메소드

public hasExtension ( $name )

hasExtension() 공개 메소드

Returns true if the given extension is registered.
public hasExtension ( string $name ) : boolean
$name string The extension name
리턴 boolean Whether the extension is registered or not

initOperators() 보호된 메소드

protected initOperators ( )

initRuntime() 공개 메소드

Initializes the runtime environment.
public initRuntime ( )

isAutoReload() 공개 메소드

public isAutoReload ( )

isAutoReload() 공개 메소드

Checks if the auto_reload option is enabled.
public isAutoReload ( ) : boolean
리턴 boolean true if auto_reload is enabled, false otherwise

isDebug() 공개 메소드

public isDebug ( )

isDebug() 공개 메소드

Checks if debug mode is enabled.
public isDebug ( ) : boolean
리턴 boolean true if debug mode is enabled, false otherwise

isStrictVariables() 공개 메소드

public isStrictVariables ( )

isStrictVariables() 공개 메소드

Checks if the strict_variables option is enabled.
public isStrictVariables ( ) : boolean
리턴 boolean true if strict_variables is enabled, false otherwise

loadFilters() 보호된 메소드

Gets the registered Filters.
protected loadFilters ( ) : Twig_FilterInterface[]
리턴 Twig_FilterInterface[] An array of Twig_FilterInterface instances

loadFunctions() 보호된 메소드

protected loadFunctions ( )

loadTemplate() 공개 메소드

Loads a template by name.
public loadTemplate ( string $name ) : Twig_TemplateInterface
$name string The template name
리턴 Twig_TemplateInterface A template instance representing the given template name

parse() 공개 메소드

public parse ( Twig_TokenStream $tokens )
$tokens Twig_TokenStream

parse() 공개 메소드

Parses a token stream.
public parse ( Twig_TokenStream $tokens ) : Twig_Node_Module
$tokens Twig_TokenStream A Twig_TokenStream instance
리턴 Twig_Node_Module A Node tree

registerUndefinedFilterCallback() 공개 메소드

public registerUndefinedFilterCallback ( $callable )

registerUndefinedFunctionCallback() 공개 메소드

public registerUndefinedFunctionCallback ( $callable )

removeExtension() 공개 메소드

public removeExtension ( $name )

removeExtension() 공개 메소드

Removes an extension by name.
public removeExtension ( string $name )
$name string The extension name

render() 공개 메소드

Renders a template.
public render ( string $name, array $context = [] ) : string
$name string The template name
$context array An array of parameters to pass to the template
리턴 string The rendered template

setAutoReload() 공개 메소드

public setAutoReload ( $autoReload )

setBaseTemplateClass() 공개 메소드

public setBaseTemplateClass ( $class )

setBaseTemplateClass() 공개 메소드

Sets the base template class for compiled templates.
public setBaseTemplateClass ( string $class )
$class string The base template class name

setCache() 공개 메소드

public setCache ( $cache )

setCache() 공개 메소드

Sets the cache directory or false if cache is disabled.
public setCache ( string | false $cache )
$cache string | false The absolute path to the compiled templates, or false to disable cache

setCharset() 공개 메소드

public setCharset ( $charset )

setCharset() 공개 메소드

Sets the default template charset.
public setCharset ( string $charset )
$charset string The default charset

setCompiler() 공개 메소드

Sets the Compiler instance.
public setCompiler ( Twig_CompilerInterface $compiler )
$compiler Twig_CompilerInterface A Twig_CompilerInterface instance

setExtensions() 공개 메소드

Registers an array of extensions.
public setExtensions ( array $extensions )
$extensions array An array of extensions

setLexer() 공개 메소드

Sets the Lexer instance.
public setLexer ( Twig_LexerInterface $lexer )
$lexer Twig_LexerInterface

setLoader() 공개 메소드

Sets the Loader instance.
public setLoader ( Twig_LoaderInterface $loader )
$loader Twig_LoaderInterface A Twig_LoaderInterface instance

setParser() 공개 메소드

Sets the Parser instance.
public setParser ( Twig_ParserInterface $parser )
$parser Twig_ParserInterface

tokenize() 공개 메소드

public tokenize ( $source, $name )

tokenize() 공개 메소드

Tokenizes a source code.
public tokenize ( string $source, string $name = null ) : Twig_TokenStream
$source string The template source code
$name string The template name
리턴 Twig_TokenStream A Twig_TokenStream instance

writeCacheFile() 보호된 메소드

protected writeCacheFile ( $file, $content )

프로퍼티 상세

$autoReload 보호되어 있는 프로퍼티

protected $autoReload

$baseTemplateClass 보호되어 있는 프로퍼티

protected $baseTemplateClass

$binaryOperators 보호되어 있는 프로퍼티

protected $binaryOperators

$cache 보호되어 있는 프로퍼티

protected $cache

$charset 보호되어 있는 프로퍼티

protected $charset

$compiler 보호되어 있는 프로퍼티

protected $compiler

$debug 보호되어 있는 프로퍼티

protected $debug

$extensions 보호되어 있는 프로퍼티

protected $extensions

$filterCallbacks 보호되어 있는 프로퍼티

protected $filterCallbacks

$filters 보호되어 있는 프로퍼티

protected $filters

$functionCallbacks 보호되어 있는 프로퍼티

protected $functionCallbacks

$functions 보호되어 있는 프로퍼티

protected $functions

$globals 보호되어 있는 프로퍼티

protected $globals

$lexer 보호되어 있는 프로퍼티

protected $lexer

$loadedTemplates 보호되어 있는 프로퍼티

protected $loadedTemplates

$loader 보호되어 있는 프로퍼티

protected $loader

$parser 보호되어 있는 프로퍼티

protected $parser

$parsers 보호되어 있는 프로퍼티

protected $parsers

$runtimeInitialized 보호되어 있는 프로퍼티

protected $runtimeInitialized

$strictVariables 보호되어 있는 프로퍼티

protected $strictVariables

$templateClassPrefix 보호되어 있는 프로퍼티

protected $templateClassPrefix

$tests 보호되어 있는 프로퍼티

protected $tests

$unaryOperators 보호되어 있는 프로퍼티

protected $unaryOperators

$visitors 보호되어 있는 프로퍼티

protected $visitors