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