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