Skip to content

Commit

Permalink
add comments to ExtensionInterface to help developers with creating t…
Browse files Browse the repository at this point in the history
…heir own Extensions
  • Loading branch information
wisskid committed Dec 1, 2023
1 parent c011891 commit c338585
Showing 1 changed file with 66 additions and 4 deletions.
70 changes: 66 additions & 4 deletions src/Extension/ExtensionInterface.php
Expand Up @@ -2,20 +2,82 @@

namespace Smarty\Extension;

use Smarty\BlockHandler\BlockHandlerInterface;
use Smarty\Compile\CompilerInterface;
use Smarty\Compile\Modifier\ModifierCompilerInterface;
use Smarty\FunctionHandler\FunctionHandlerInterface;

interface ExtensionInterface {

public function getTagCompiler(string $tag): ?\Smarty\Compile\CompilerInterface;
/**
* Either return \Smarty\Compile\CompilerInterface that will compile the given $tag or
* return null to indicate that you do not know how to handle this $tag. (Another Extension might.)
*
* @param string $tag
* @return CompilerInterface|null
*/
public function getTagCompiler(string $tag): ?CompilerInterface;

public function getModifierCompiler(string $modifier): ?\Smarty\Compile\Modifier\ModifierCompilerInterface;
/**
* Either return \Smarty\Compile\Modifier\ModifierCompilerInterface that will compile the given $modifier or
* return null to indicate that you do not know how to handle this $modifier. (Another Extension might.)
*
* @param string $modifier
* @return ModifierCompilerInterface|null
*/
public function getModifierCompiler(string $modifier): ?ModifierCompilerInterface;

public function getFunctionHandler(string $functionName): ?\Smarty\FunctionHandler\FunctionHandlerInterface;
/**
* Either return \Smarty\FunctionHandler\FunctionHandlerInterface that will handle the given $functionName or
* return null to indicate that you do not know how to handle this $functionName. (Another Extension might.)
*
* @param string $functionName
* @return FunctionHandlerInterface|null
*/
public function getFunctionHandler(string $functionName): ?FunctionHandlerInterface;

public function getBlockHandler(string $blockTagName): ?\Smarty\BlockHandler\BlockHandlerInterface;
/**
* Either return \Smarty\BlockHandler\BlockHandlerInterface that will handle the given $blockTagName or return null
* to indicate that you do not know how to handle this $blockTagName. (Another Extension might.)
*
* @param string $blockTagName
* @return BlockHandlerInterface|null
*/
public function getBlockHandler(string $blockTagName): ?BlockHandlerInterface;

/**
* Either return a callable that takes at least 1 parameter (a string) and returns a modified string or return null
* to indicate that you do not know how to handle this $modifierName. (Another Extension might.)
*
* The callable can accept additional optional parameters.
*
* @param string $modifierName
* @return callable|null
*/
public function getModifierCallback(string $modifierName);

/**
* Return a list of prefilters that will all be applied, in sequence.
* Template prefilters can be used to preprocess templates before they are compiled.
*
* @return \Smarty\Filter\FilterInterface[]
*/
public function getPreFilters(): array;

/**
* Return a list of postfilters that will all be applied, in sequence.
* Template postfilters can be used to process compiled template code (so, after the compilation).
*
* @return \Smarty\Filter\FilterInterface[]
*/
public function getPostFilters(): array;

/**
* Return a list of outputfilters that will all be applied, in sequence.
* Template outputfilters can be used to change template output just before it is rendered.
*
* @return \Smarty\Filter\FilterInterface[]
*/
public function getOutputFilters(): array;

}

0 comments on commit c338585

Please sign in to comment.