xref: /dokuwiki/inc/Parsing/Handler/AbstractRewriter.php (revision 533aca443d11c7850d99ed088b80c85fdff14be3)
1*533aca44SAndreas Gohr<?php
2*533aca44SAndreas Gohr
3*533aca44SAndreas Gohrnamespace dokuwiki\Parsing\Handler;
4*533aca44SAndreas Gohr
5*533aca44SAndreas Gohr/**
6*533aca44SAndreas Gohr * Basic implementation of the rewriter interface to be specialized by children
7*533aca44SAndreas Gohr */
8*533aca44SAndreas Gohrabstract class AbstractRewriter implements ReWriterInterface
9*533aca44SAndreas Gohr{
10*533aca44SAndreas Gohr    /** @var CallWriterInterface original CallWriter */
11*533aca44SAndreas Gohr    protected $callWriter;
12*533aca44SAndreas Gohr
13*533aca44SAndreas Gohr    /** @var array[] list of calls */
14*533aca44SAndreas Gohr    public $calls = array();
15*533aca44SAndreas Gohr
16*533aca44SAndreas Gohr    /** @inheritdoc */
17*533aca44SAndreas Gohr    public function __construct(CallWriterInterface $callWriter)
18*533aca44SAndreas Gohr    {
19*533aca44SAndreas Gohr        $this->callWriter = $callWriter;
20*533aca44SAndreas Gohr    }
21*533aca44SAndreas Gohr
22*533aca44SAndreas Gohr    /** @inheritdoc */
23*533aca44SAndreas Gohr    public function writeCall($call)
24*533aca44SAndreas Gohr    {
25*533aca44SAndreas Gohr        $this->calls[] = $call;
26*533aca44SAndreas Gohr    }
27*533aca44SAndreas Gohr
28*533aca44SAndreas Gohr    /** * @inheritdoc */
29*533aca44SAndreas Gohr    public function writeCalls($calls)
30*533aca44SAndreas Gohr    {
31*533aca44SAndreas Gohr        $this->calls = array_merge($this->calls, $calls);
32*533aca44SAndreas Gohr    }
33*533aca44SAndreas Gohr
34*533aca44SAndreas Gohr    /** @inheritDoc */
35*533aca44SAndreas Gohr    public function getCallWriter()
36*533aca44SAndreas Gohr    {
37*533aca44SAndreas Gohr        return $this->callWriter;
38*533aca44SAndreas Gohr    }
39*533aca44SAndreas Gohr}
40