Skip to content

Instantly share code, notes, and snippets.

@shinigamicorei7
Created August 22, 2015 06:26
Show Gist options
  • Save shinigamicorei7/5a469e1728acc4795c23 to your computer and use it in GitHub Desktop.
Save shinigamicorei7/5a469e1728acc4795c23 to your computer and use it in GitHub Desktop.
Ide Helper para el repositorio https://github.com/shinigamicorei7/view
<?php
namespace {
class View extends \Matrix\View\ViewManager
{
/**
* Gets the base template class for compiled templates.
*
* @return string The base template class name
*/
public static function getBaseTemplateClass()
{
return \Twig_Environment::getBaseTemplateClass();
}
/**
* Sets the base template class for compiled templates.
*
* @param string $class The base template class name
*/
public static function setBaseTemplateClass($class)
{
return \Twig_Environment::setBaseTemplateClass($class);
}
/**
* Enables debugging mode.
*/
public static function enableDebug()
{
return \Twig_Environment::enableDebug();
}
/**
* Disables debugging mode.
*/
public static function disableDebug()
{
return \Twig_Environment::disableDebug();
}
/**
* Checks if debug mode is enabled.
*
* @return bool true if debug mode is enabled, false otherwise
*/
public static function isDebug()
{
return \Twig_Environment::isDebug();
}
/**
* Enables the auto_reload option.
*/
public static function enableAutoReload()
{
return \Twig_Environment::enableAutoReload();
}
/**
* Disables the auto_reload option.
*/
public static function disableAutoReload()
{
return \Twig_Environment::disableAutoReload();
}
/**
* Checks if the auto_reload option is enabled.
*
* @return bool true if auto_reload is enabled, false otherwise
*/
public static function isAutoReload()
{
return \Twig_Environment::isAutoReload();
}
/**
* Enables the strict_variables option.
*/
public static function enableStrictVariables()
{
return \Twig_Environment::enableStrictVariables();
}
/**
* Disables the strict_variables option.
*/
public static function disableStrictVariables()
{
return \Twig_Environment::disableStrictVariables();
}
/**
* Checks if the strict_variables option is enabled.
*
* @return bool true if strict_variables is enabled, false otherwise
*/
public static function isStrictVariables()
{
return \Twig_Environment::isStrictVariables();
}
/**
* Gets the cache directory or false if cache is disabled.
*
* @return string|false
*/
public static function getCache()
{
return \Twig_Environment::getCache();
}
/**
* Gets the cache filename for a given template.
*
* @param string $name The template name
*
* @return string|false The cache file name or false when caching is disabled
*/
public static function setCache($name)
{
return \Twig_Environment::setCache($name);
}
/**
* Gets the cache filename for a given template.
*
* @param string $name The template name
*
* @return string|false The cache file name or false when caching is disabled
*/
public static function getCacheFilename($name)
{
return \Twig_Environment::getCacheFilename($name);
}
/**
* Gets the template class associated with the given string.
*
* @param string $name The name for which to calculate the template class name
* @param int $index The index if it is an embedded template
*
* @return string The template class name
*/
public static function getTemplateClass($name, $index = null)
{
return \Twig_Environment::getTemplateClass($name, $index);
}
/**
* Gets the template class prefix.
*
* @return string The template class prefix
*/
public static function getTemplateClassPrefix()
{
return \Twig_Environment::getTemplateClassPrefix();
}
/**
* Renders a template.
*
* @param string $name The template name
* @param array $context An array of parameters to pass to the template
*
* @return string The rendered template
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
* @throws Twig_Error_Runtime When an error occurred during rendering
*/
public static function render($name, array $context = array())
{
return \Twig_Environment::render($name, $context);
}
/**
* Displays a template.
*
* @param string $name The template name
* @param array $context An array of parameters to pass to the template
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
* @throws Twig_Error_Runtime When an error occurred during rendering
*/
public static function display($name, array $context = array())
{
return \Twig_Environment::display($name, $context);
}
/**
* Loads a template by name.
*
* @param string $name The template name
* @param int $index The index if it is an embedded template
*
* @return Twig_TemplateInterface A template instance representing the given template name
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
*/
public static function loadTemplate($name, $index = null)
{
return \Twig_Environment::loadTemplate($name, $index);
}
/**
* Creates a template from source.
*
* This method should not be used as a generic way to load templates.
*
* @param string $template The template name
*
* @return Twig_Template A template instance representing the given template name
*
* @throws Twig_Error_Loader When the template cannot be found
* @throws Twig_Error_Syntax When an error occurred during compilation
*/
public static function createTemplate($template)
{
return \Twig_Environment::createTemplate($template);
}
/**
* Returns true if the template is still fresh.
*
* Besides checking the loader for freshness information,
* this method also checks if the enabled extensions have
* not changed.
*
* @param string $name The template name
* @param int $time The last modification time of the cached template
*
* @return bool true if the template is fresh, false otherwise
*/
public static function isTemplateFresh($name, $time)
{
return \Twig_Environment::isTemplateFresh($name, $time);
}
/**
* Tries to load a template consecutively from an array.
*
* Similar to loadTemplate() but it also accepts Twig_TemplateInterface instances and an array
* of templates where each is tried to be loaded.
*
* @param string|Twig_Template|array $names A template or an array of templates to try consecutively
*
* @return Twig_Template
*
* @throws Twig_Error_Loader When none of the templates can be found
* @throws Twig_Error_Syntax When an error occurred during compilation
*/
public static function resolveTemplate($names)
{
return \Twig_Environment::resolveTemplate($names);
}
/**
* Clears the internal template cache.
*
* @deprecated since 1.18.3 (to be removed in 2.0)
*/
public static function clearTemplateCache()
{
return \Twig_Environment::clearTemplateCache();
}
/**
* Clears the template cache files on the filesystem.
*/
public static function clearCacheFiles()
{
return \Twig_Environment::clearCacheFiles();
}
/**
* Gets the Lexer instance.
*
* @return Twig_LexerInterface A Twig_LexerInterface instance
*/
public static function getLexer()
{
return \Twig_Environment::getLexer();
}
/**
* Sets the Lexer instance.
*
* @param Twig_LexerInterface $lexer A Twig_LexerInterface instance
*/
public static function setLexer(Twig_LexerInterface $lexer)
{
return \Twig_Environment::setLexer($lexer);
}
/**
* Tokenizes a source code.
*
* @param string $source The template source code
* @param string $name The template name
*
* @return Twig_TokenStream A Twig_TokenStream instance
*
* @throws Twig_Error_Syntax When the code is syntactically wrong
*/
public static function tokenize($source, $name = null)
{
return \Twig_Environment::tokenize($source, $name);
}
/**
* Gets the Parser instance.
*
* @return Twig_ParserInterface A Twig_ParserInterface instance
*/
public static function getParser()
{
return \Twig_Environment::getParser();
}
/**
* Sets the Parser instance.
*
* @param Twig_ParserInterface $parser A Twig_ParserInterface instance
*/
public static function setParser(Twig_ParserInterface $parser)
{
return \Twig_Environment::setParser($parser);
}
/**
* Converts a token stream to a node tree.
*
* @param Twig_TokenStream $stream A token stream instance
*
* @return Twig_Node_Module A node tree
*
* @throws Twig_Error_Syntax When the token stream is syntactically or semantically wrong
*/
public static function parse(Twig_TokenStream $stream)
{
return \Twig_Environment::parse($stream);
}
/**
* Gets the Compiler instance.
*
* @return Twig_CompilerInterface A Twig_CompilerInterface instance
*/
public static function getCompiler()
{
return \Twig_Environment::getCompiler();
}
/**
* Sets the Compiler instance.
*
* @param Twig_CompilerInterface $compiler A Twig_CompilerInterface instance
*/
public static function setCompiler(Twig_CompilerInterface $compiler)
{
return \Twig_Environment::setCompiler($compiler);
}
/**
* Compiles a node and returns the PHP code.
*
* @param Twig_NodeInterface $node A Twig_NodeInterface instance
*
* @return string The compiled PHP source code
*/
public static function compile(Twig_NodeInterface $node)
{
return \Twig_Environment::compile($node);
}
/**
* Compiles a template source code.
*
* @param string $source The template source code
* @param string $name The template name
*
* @return string The compiled PHP source code
*
* @throws Twig_Error_Syntax When there was an error during tokenizing, parsing or compiling
*/
public static function compileSource($source, $name = null)
{
return \Twig_Environment::compileSource($source, $name);
}
/**
* Sets the Loader instance.
*
* @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance
*/
public static function setLoader(Twig_LoaderInterface $loader)
{
return \Twig_Environment::setLoader($loader);
}
/**
* Gets the Loader instance.
*
* @return Twig_LoaderInterface A Twig_LoaderInterface instance
*/
public static function getLoader()
{
return \Twig_Environment::getLoader();
}
/**
* Sets the default template charset.
*
* @param string $charset The default charset
*/
public static function setCharset($charset)
{
return \Twig_Environment::setCharset($charset);
}
/**
* Gets the default template charset.
*
* @return string The default charset
*/
public static function getCharset()
{
return \Twig_Environment::getCharset();
}
/**
* Initializes the runtime environment.
*/
public static function initRuntime()
{
return \Twig_Environment::initRuntime();
}
/**
* Returns true if the given extension is registered.
*
* @param string $name The extension name
*
* @return bool Whether the extension is registered or not
*/
public static function hasExtension($name)
{
return \Twig_Environment::hasExtension($name);
}
/**
* Gets an extension by name.
*
* @param string $name The extension name
*
* @return Twig_ExtensionInterface A Twig_ExtensionInterface instance
*/
public static function getExtension($name)
{
return \Twig_Environment::getExtension($name);
}
/**
* Registers an extension.
*
* @param Twig_ExtensionInterface $extension A Twig_ExtensionInterface instance
*/
public static function addExtension(Twig_ExtensionInterface $extension)
{
return \Twig_Environment::addExtension($extension);
}
/**
* Removes an extension by name.
*
* This method is deprecated and you should not use it.
*
* @param string $name The extension name
*
* @deprecated since 1.12 (to be removed in 2.0)
*/
public static function removeExtension($name)
{
return \Twig_Environment::removeExtension($name);
}
/**
* Registers an array of extensions.
*
* @param array $extensions An array of extensions
*/
public static function setExtensions($extensions)
{
return \Twig_Environment::setExtensions($extensions);
}
/**
* Returns all registered extensions.
*
* @return array An array of extensions
*/
public static function getExtensions()
{
return \Twig_Environment::getExtensions();
}
/**
* Registers a Token Parser.
*
* @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance
*/
public static function addTokenParser(Twig_TokenParserInterface $parser)
{
return \Twig_Environment::addTokenParser($parser);
}
/**
* Gets the registered Token Parsers.
*
* @return Twig_TokenParserBrokerInterface A broker containing token parsers
*/
public static function getTokenParsers()
{
return \Twig_Environment::getTokenParsers();
}
/**
* Gets registered tags.
*
* Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes.
*
* @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances
*/
public static function getTags()
{
return \Twig_Environment::getTags();
}
/**
* Registers a Node Visitor.
*
* @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance
*/
public static function addNodeVisitor(Twig_NodeVisitorInterface $visitor)
{
return \Twig_Environment::addNodeVisitor();
}
/**
* Gets the registered Node Visitors.
*
* @return Twig_NodeVisitorInterface[] An array of Twig_NodeVisitorInterface instances
*/
public static function getNodeVisitors()
{
return \Twig_Environment::getNodeVisitors();
}
/**
* Registers a Filter.
*
* @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance
* @param Twig_FilterInterface|Twig_SimpleFilter $filter A Twig_FilterInterface instance or a Twig_SimpleFilter instance
*/
public static function addFilter($name, $filter = null)
{
return \Twig_Environment::addFilter($name, $filter);
}
/**
* Get a filter by name.
*
* Subclasses may override this method and load filters differently;
* so no list of filters is available.
*
* @param string $name The filter name
*
* @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist
*/
public static function getFilter($name)
{
return \Twig_Environment::getFilter($name);
}
public static function registerUndefinedFilterCallback()
{
return \Twig_Environment::registerUndefinedFilterCallback();
}
/**
* Gets the registered Filters.
*
* Be warned that this method cannot return filters defined with registerUndefinedFunctionCallback.
*
* @return Twig_FilterInterface[] An array of Twig_FilterInterface instances
*
* @see registerUndefinedFilterCallback
*/
public static function getFilters()
{
return \Twig_Environment::getFilters();
}
/**
* Registers a Test.
*
* @param string|Twig_SimpleTest $name The test name or a Twig_SimpleTest instance
* @param Twig_TestInterface|Twig_SimpleTest $test A Twig_TestInterface instance or a Twig_SimpleTest instance
*/
public static function addTest($name, $test = null)
{
return \Twig_Environment::addTest($name, $test);
}
/**
* Gets the registered Tests.
*
* @return Twig_TestInterface[] An array of Twig_TestInterface instances
*/
public static function getTests()
{
return \Twig_Environment::getTests();
}
/**
* Gets a test by name.
*
* @param string $name The test name
*
* @return Twig_Test|false A Twig_Test instance or false if the test does not exist
*/
public static function getTest($name)
{
return \Twig_Environment::getTest($name);
}
/**
* Registers a Function.
*
* @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance
* @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance
*/
public static function addFunction($name, $function = null)
{
return \Twig_Environment::addFunction($name, $function);
}
/**
* Get a function by name.
*
* Subclasses may override this method and load functions differently;
* so no list of functions is available.
*
* @param string $name function name
*
* @return Twig_Function|false A Twig_Function instance or false if the function does not exist
*/
public static function getFunction($name)
{
return \Twig_Environment::getFunction($name);
}
public static function registerUndefinedFunctionCallback()
{
return \Twig_Environment::registerUndefinedFunctionCallback();
}
/**
* Gets registered functions.
*
* Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback.
*
* @return Twig_FunctionInterface[] An array of Twig_FunctionInterface instances
*
* @see registerUndefinedFunctionCallback
*/
public static function getFunctions()
{
return \Twig_Environment::getFunctions();
}
/**
* Registers a Global.
*
* New globals can be added before compiling or rendering a template;
* but after, you can only update existing globals.
*
* @param string $name The global name
* @param mixed $value The global value
*/
public static function addGlobal($name, $value)
{
return \Twig_Environment::addGlobal($name, $value);
}
/**
* Gets the registered Globals.
*
* @return array An array of globals
*/
public static function getGlobals()
{
return \Twig_Environment::getGlobals();
}
/**
* Merges a context with the defined globals.
*
* @param array $context An array representing the context
*
* @return array The context merged with the globals
*/
public static function mergeGlobals(array $context)
{
return \Twig_Environment::mergeGlobals($context);
}
/**
* Gets the registered unary Operators.
*
* @return array An array of unary operators
*/
public static function getUnaryOperators()
{
return \Twig_Environment::getUnaryOperators();
}
/**
* Gets the registered binary Operators.
*
* @return array An array of binary operators
*/
public static function getBinaryOperators()
{
return \Twig_Environment::getBinaryOperators();
}
public static function computeAlternatives()
{
return \Twig_Environment::computeAlternatives();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment