summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Wisselink <s.wisselink@iwink.nl>2023-12-01 23:08:37 +0100
committerSimon Wisselink <s.wisselink@iwink.nl>2023-12-01 23:08:37 +0100
commitc33858579144f857b917a00581d4fafae9503fb6 (patch)
tree904cfc428264d4eec467441f1398df2f492e16a8 /src
parentc011891247580ead4896359d2a39584967b524e0 (diff)
downloadsmarty-c33858579144f857b917a00581d4fafae9503fb6.tar.gz
smarty-c33858579144f857b917a00581d4fafae9503fb6.tar.bz2
smarty-c33858579144f857b917a00581d4fafae9503fb6.zip
add comments to ExtensionInterface to help developers with creating their own Extensions
Diffstat (limited to 'src')
-rw-r--r--src/Extension/ExtensionInterface.php70
1 files changed, 66 insertions, 4 deletions
diff --git a/src/Extension/ExtensionInterface.php b/src/Extension/ExtensionInterface.php
index 50752f5d..72e358ee 100644
--- a/src/Extension/ExtensionInterface.php
+++ b/src/Extension/ExtensionInterface.php
@@ -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;
} \ No newline at end of file