1<?php
2namespace TYPO3Fluid\Fluid\Core\Parser;
3
4/*
5 * This file belongs to the package "TYPO3 Fluid".
6 * See LICENSE.txt that was shipped with this package.
7 */
8
9use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface;
10
11/**
12 * An interceptor interface. Interceptors are used in the parsing stage to change
13 * the syntax tree of a template, e.g. by adding viewhelper nodes.
14 */
15interface InterceptorInterface
16{
17
18    const INTERCEPT_OPENING_VIEWHELPER = 1;
19    const INTERCEPT_CLOSING_VIEWHELPER = 2;
20    const INTERCEPT_TEXT = 3;
21    const INTERCEPT_OBJECTACCESSOR = 4;
22    const INTERCEPT_EXPRESSION = 5;
23
24    /**
25     * The interceptor can process the given node at will and must return a node
26     * that will be used in place of the given node.
27     *
28     * @param NodeInterface $node
29     * @param integer $interceptorPosition One of the INTERCEPT_* constants for the current interception point
30     * @param ParsingState $parsingState the parsing state
31     * @return NodeInterface
32     */
33    public function process(NodeInterface $node, $interceptorPosition, ParsingState $parsingState);
34
35    /**
36     * The interceptor should define at which interception positions it wants to be called.
37     *
38     * @return array Array of INTERCEPT_* constants
39     */
40    public function getInterceptionPoints();
41}
42