xref: /dokuwiki/inc/Parsing/Handler/AbstractRewriter.php (revision bcaec9f47d06126b3e653fea89a86d8b6a6cbef8)
1533aca44SAndreas Gohr<?php
2533aca44SAndreas Gohr
3533aca44SAndreas Gohrnamespace dokuwiki\Parsing\Handler;
4533aca44SAndreas Gohr
5533aca44SAndreas Gohr/**
6533aca44SAndreas Gohr * Basic implementation of the rewriter interface to be specialized by children
7533aca44SAndreas Gohr */
8533aca44SAndreas Gohrabstract class AbstractRewriter implements ReWriterInterface
9533aca44SAndreas Gohr{
10533aca44SAndreas Gohr    /** @var CallWriterInterface original CallWriter */
11533aca44SAndreas Gohr    protected $callWriter;
12533aca44SAndreas Gohr
13533aca44SAndreas Gohr    /** @var array[] list of calls */
14*bcaec9f4SAndreas Gohr    public $calls = [];
15533aca44SAndreas Gohr
16533aca44SAndreas Gohr    /** @inheritdoc */
17533aca44SAndreas Gohr    public function __construct(CallWriterInterface $callWriter)
18533aca44SAndreas Gohr    {
19533aca44SAndreas Gohr        $this->callWriter = $callWriter;
20533aca44SAndreas Gohr    }
21533aca44SAndreas Gohr
22533aca44SAndreas Gohr    /** @inheritdoc */
23533aca44SAndreas Gohr    public function writeCall($call)
24533aca44SAndreas Gohr    {
25533aca44SAndreas Gohr        $this->calls[] = $call;
26533aca44SAndreas Gohr    }
27533aca44SAndreas Gohr
28533aca44SAndreas Gohr    /** * @inheritdoc */
29533aca44SAndreas Gohr    public function writeCalls($calls)
30533aca44SAndreas Gohr    {
31533aca44SAndreas Gohr        $this->calls = array_merge($this->calls, $calls);
32533aca44SAndreas Gohr    }
33533aca44SAndreas Gohr
34533aca44SAndreas Gohr    /** @inheritDoc */
35533aca44SAndreas Gohr    public function getCallWriter()
36533aca44SAndreas Gohr    {
37533aca44SAndreas Gohr        return $this->callWriter;
38533aca44SAndreas Gohr    }
39533aca44SAndreas Gohr}
40