xref: /dokuwiki/inc/Parsing/Handler/CallWriter.php (revision 71096e46fcbfaeaa808667aba794e77fe2780169)
1be906b56SAndreas Gohr<?php
2be906b56SAndreas Gohr
3be906b56SAndreas Gohrnamespace dokuwiki\Parsing\Handler;
4be906b56SAndreas Gohr
5*71096e46SAndreas Gohruse dokuwiki\Parsing\Handler;
6*71096e46SAndreas Gohr
7be906b56SAndreas Gohrclass CallWriter implements CallWriterInterface
8be906b56SAndreas Gohr{
9*71096e46SAndreas Gohr    /** @var Handler $Handler */
10be906b56SAndreas Gohr    protected $Handler;
11be906b56SAndreas Gohr
12be906b56SAndreas Gohr    /**
13*71096e46SAndreas Gohr     * @param Handler $Handler
14be906b56SAndreas Gohr     */
15*71096e46SAndreas Gohr    public function __construct(Handler $Handler)
16be906b56SAndreas Gohr    {
17be906b56SAndreas Gohr        $this->Handler = $Handler;
18be906b56SAndreas Gohr    }
19be906b56SAndreas Gohr
20be906b56SAndreas Gohr    /** @inheritdoc */
21be906b56SAndreas Gohr    public function writeCall($call)
22be906b56SAndreas Gohr    {
23be906b56SAndreas Gohr        $this->Handler->calls[] = $call;
24be906b56SAndreas Gohr    }
25be906b56SAndreas Gohr
26be906b56SAndreas Gohr    /** @inheritdoc */
27be906b56SAndreas Gohr    public function writeCalls($calls)
28be906b56SAndreas Gohr    {
29be906b56SAndreas Gohr        $this->Handler->calls = array_merge($this->Handler->calls, $calls);
30be906b56SAndreas Gohr    }
31be906b56SAndreas Gohr
32be906b56SAndreas Gohr    /**
33be906b56SAndreas Gohr     * @inheritdoc
34be906b56SAndreas Gohr     * function is required, but since this call writer is first/highest in
35be906b56SAndreas Gohr     * the chain it is not required to do anything
36be906b56SAndreas Gohr     */
37be906b56SAndreas Gohr    public function finalise()
38be906b56SAndreas Gohr    {
39be906b56SAndreas Gohr        unset($this->Handler);
40be906b56SAndreas Gohr    }
41be906b56SAndreas Gohr}
42