Passed
Pull Request — master (#65)
by Michael
02:10
created

renderer_plugin_prosemirror::htmlblock()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 1
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * DokuWiki Plugin prosemirror (Renderer Component)
4
 *
5
 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html
6
 * @author  Andreas Gohr <[email protected]>
7
 */
8
9
// must be run within Dokuwiki
10
use dokuwiki\plugin\prosemirror\schema\Mark;
11
use dokuwiki\plugin\prosemirror\schema\Node;
12
use dokuwiki\plugin\prosemirror\schema\NodeStack;
13
14
if (!defined('DOKU_INC')) {
15
    die();
16
}
17
18
require_once DOKU_INC . 'inc/parser/renderer.php';
0 ignored issues
show
Bug introduced by
The constant DOKU_INC was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
19
20
class renderer_plugin_prosemirror extends Doku_Renderer
21
{
22
23
    /** @var  NodeStack */
24
    public $nodestack;
25
26
    /** @var NodeStack[] */
27
    protected $nodestackBackup = [];
28
29
    /** @var array list of currently active formatting marks */
30
    protected $marks = [];
31
32
    /** @var int column counter for table handling */
33
    protected $colcount = 0;
34
35
    /**
36
     * The format this renderer produces
37
     */
38
    public function getFormat()
39
    {
40
        return 'prosemirror';
41
    }
42
43
    public function addToNodestackTop(Node $node)
44
    {
45
        $this->nodestack->addTop($node);
46
    }
47
48
    public function addToNodestack(Node $node)
49
    {
50
        $this->nodestack->add($node);
51
    }
52
53
    public function dropFromNodeStack($nodeType)
54
    {
55
        $this->nodestack->drop($nodeType);
56
    }
57
58
    public function getCurrentMarks()
59
    {
60
        return $this->marks;
61
    }
62
63
    /**
64
     * If there is a block scope open, close it.
65
     */
66
    protected function clearBlock()
67
    {
68
        $parentNode = $this->nodestack->current()->getType();
69
        if (in_array($parentNode, ['paragraph'])) {
70
            $this->nodestack->drop($parentNode);
71
        }
72
    }
73
74
    // FIXME implement all methods of Doku_Renderer here
75
76
    /** @inheritDoc */
77
    function document_start()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
78
    {
79
        $this->nodestack = new NodeStack();
80
    }
81
82
    /** @inheritDoc */
83
    function document_end()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
84
    {
85
        if ($this->nodestack->isEmpty()) {
86
            $this->p_open();
87
            $this->p_close();
88
        }
89
        $this->doc = json_encode($this->nodestack->doc(), JSON_PRETTY_PRINT);
0 ignored issues
show
Bug Best Practice introduced by
The property doc does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
90
    }
91
92
    /** @inheritDoc */
93
    function p_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
94
    {
95
        $this->nodestack->addTop(new Node('paragraph'));
96
    }
97
98
    /** @inheritdoc */
99
    function p_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
100
    {
101
        $this->nodestack->drop('paragraph');
102
    }
103
104
    /** @inheritDoc */
105
    function quote_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
106
    {
107
        if ($this->nodestack->current()->getType() === 'paragraph') {
108
            $this->nodestack->drop('paragraph');
109
        }
110
        $this->nodestack->addTop(new Node('blockquote'));
111
    }
112
113
    /** @inheritDoc */
114
    function quote_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
115
    {
116
        if ($this->nodestack->current()->getType() === 'paragraph') {
117
            $this->nodestack->drop('paragraph');
118
        }
119
        $this->nodestack->drop('blockquote');
120
    }
121
122
    #region lists
123
124
    /** @inheritDoc */
125
    function listu_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
126
    {
127
        if ($this->nodestack->current()->getType() === 'paragraph') {
128
            $this->nodestack->drop('paragraph');
129
        }
130
131
        $this->nodestack->addTop(new Node('bullet_list'));
132
    }
133
134
    /** @inheritDoc */
135
    function listu_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
136
    {
137
        $this->nodestack->drop('bullet_list');
138
    }
139
140
    /** @inheritDoc */
141
    function listo_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
142
    {
143
        if ($this->nodestack->current()->getType() === 'paragraph') {
144
            $this->nodestack->drop('paragraph');
145
        }
146
147
        $this->nodestack->addTop(new Node('ordered_list'));
148
    }
149
150
    /** @inheritDoc */
151
    function listo_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
152
    {
153
        $this->nodestack->drop('ordered_list');
154
    }
155
156
    /** @inheritDoc */
157
    function listitem_open($level, $node = false)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
158
    {
159
        $this->nodestack->addTop(new Node('list_item'));
160
    }
161
162
    /** @inheritDoc */
163
    function listitem_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
164
    {
165
166
        if ($this->nodestack->current()->getType() === 'paragraph') {
167
            $this->nodestack->drop('paragraph');
168
        }
169
        $this->nodestack->drop('list_item');
170
    }
171
172
    #endregion lists
173
174
    #region table
175
176
    /** @inheritDoc */
177
    function table_open($maxcols = null, $numrows = null, $pos = null)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
178
    {
179
        $this->nodestack->addTop(new Node('table'));
180
    }
181
182
    /** @inheritDoc */
183
    function table_close($pos = null)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
184
    {
185
        $this->nodestack->drop('table');
186
    }
187
188
    /** @inheritDoc */
189
    function tablerow_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
190
    {
191
        $this->nodestack->addTop(new Node('table_row'));
192
        $this->colcount = 0;
193
    }
194
195
    /** @inheritDoc */
196
    function tablerow_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
197
    {
198
        $node = $this->nodestack->drop('table_row');
199
        $node->attr('columns', $this->colcount);
200
    }
201
202
    /** @inheritDoc */
203
    function tablecell_open($colspan = 1, $align = null, $rowspan = 1)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
204
    {
205
        $this->openTableCell('table_cell', $colspan, $align, $rowspan);
206
    }
207
208
    /** @inheritdoc */
209
    function tablecell_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
210
    {
211
        $this->closeTableCell('table_cell');
212
    }
213
214
    /** @inheritDoc */
215
    function tableheader_open($colspan = 1, $align = null, $rowspan = 1)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
216
    {
217
        $this->openTableCell('table_header', $colspan, $align, $rowspan);
218
    }
219
220
    /** @inheritdoc */
221
    function tableheader_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
222
    {
223
        $this->closeTableCell('table_header');
224
    }
225
226
    /**
227
     * Add a new table cell to the top of the stack
228
     *
229
     * @param string      $type    either table_cell or table_header
230
     * @param int         $colspan
231
     * @param string|null $align   either null/left, center or right
232
     * @param int         $rowspan
233
     */
234
    protected function openTableCell($type, $colspan, $align, $rowspan) {
235
        $this->colcount += $colspan;
236
237
        $node = new Node($type);
238
        $node->attr('colspan', $colspan);
239
        $node->attr('rowspan', $rowspan);
240
        $node->attr('align', $align);
0 ignored issues
show
Bug introduced by
It seems like $align can also be of type string; however, parameter $value of dokuwiki\plugin\prosemirror\schema\Node::attr() does only seem to accept null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

240
        $node->attr('align', /** @scrutinizer ignore-type */ $align);
Loading history...
241
        $this->nodestack->addTop($node);
242
243
        $node = new Node('paragraph');
244
        $this->nodestack->addTop($node);
245
    }
246
247
    /**
248
     * Remove a table cell from the top of the stack
249
     *
250
     * @param string $type either table_cell or table_header
251
     */
252
    protected function closeTableCell($type)
253
    {
254
        if ($this->nodestack->current()->getType() === 'paragraph') {
255
            $this->nodestack->drop('paragraph');
256
        }
257
258
        $curNode = $this->nodestack->current();
259
        $curNode->trimContentLeft();
260
        $curNode->trimContentRight();
261
        $this->nodestack->drop($type);
262
    }
263
264
    #endregion table
265
266
    /** @inheritDoc */
267
    function header($text, $level, $pos)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
268
    {
269
        $node = new Node('heading');
270
        $node->attr('level', $level);
271
272
        $tnode = new Node('text');
273
        $tnode->setText($text);
274
        $node->addChild($tnode);
275
276
        $this->nodestack->add($node);
277
    }
278
279
    /** @inheritDoc */
280
    function cdata($text)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
281
    {
282
        if ($text === '') {
283
            return;
284
        }
285
286
        $parentNode = $this->nodestack->current()->getType();
287
288
        if (in_array($parentNode, ['paragraph', 'footnote'])) {
289
            $text = str_replace("\n", ' ', $text);
290
        }
291
292
        if ($parentNode === 'list_item') {
293
            $node = new Node('paragraph');
294
            $this->nodestack->addTop($node);
295
        }
296
297
        if ($parentNode === 'blockquote') {
298
            $node = new Node('paragraph');
299
            $this->nodestack->addTop($node);
300
        }
301
302
        if ($parentNode === 'doc') {
303
            $node = new Node('paragraph');
304
            $this->nodestack->addTop($node);
305
        }
306
307
        $node = new Node('text');
308
        $node->setText($text);
309
        foreach (array_keys($this->marks) as $mark) {
310
            $node->addMark(new Mark($mark));
311
        }
312
        $this->nodestack->add($node);
313
    }
314
315
    public function preformatted($text)
316
    {
317
        $this->clearBlock();
318
        $node = new Node('preformatted');
319
        $this->nodestack->addTop($node);
320
        $this->cdata($text);
321
        $this->nodestack->drop('preformatted');
322
    }
323
324
    public function code($text, $lang = null, $file = null)
325
    {
326
        $this->clearBlock();
327
        $node = new Node('code_block');
328
        $node->attr('class', 'code ' . $lang);
329
        $node->attr('data-language', $lang);
330
        $node->attr('data-filename', $file);
331
        $this->nodestack->addTop($node);
332
        $this->cdata(trim($text, "\n"));
333
        $this->nodestack->drop('code_block');
334
    }
335
336
    public function file($text, $lang = null, $file = null)
337
    {
338
        $this->code($text, $lang, $file);
339
    }
340
341
    public function html($text)
342
    {
343
        $node = new Node('html_inline');
344
        $node->attr('class', 'html_inline');
345
        $this->nodestack->addTop($node);
346
        $this->cdata(str_replace("\n", ' ', $text));
347
        $this->nodestack->drop('html_inline');
348
    }
349
350
    public function htmlblock($text)
351
    {
352
        $this->clearBlock();
353
        $node = new Node('html_block');
354
        $node->attr('class', 'html_block');
355
        $this->nodestack->addTop($node);
356
        $this->cdata(trim($text, "\n"));
357
        $this->nodestack->drop('html_block');
358
    }
359
360
    public function php($text)
361
    {
362
        $node = new Node('php_inline');
363
        $node->attr('class', 'php_inline');
364
        $this->nodestack->addTop($node);
365
        $this->cdata(str_replace("\n", ' ', $text));
366
        $this->nodestack->drop('php_inline');
367
    }
368
369
    public function phpblock($text)
370
    {
371
        $this->clearBlock();
372
        $node = new Node('php_block');
373
        $node->attr('class', 'php_block');
374
        $this->nodestack->addTop($node);
375
        $this->cdata(trim($text, "\n"));
376
        $this->nodestack->drop('php_block');
377
    }
378
379
    /**
380
     * @inheritDoc
381
     */
382
    function rss($url, $params)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
383
    {
384
        $this->clearBlock();
385
        $node = new Node('rss');
386
        $node->attr('url', hsc($url));
387
        $node->attr('max', $params['max']);
388
        $node->attr('reverse', (bool)$params['reverse']);
389
        $node->attr('author', (bool)$params['author']);
390
        $node->attr('date', (bool)$params['date']);
391
        $node->attr('details', (bool)$params['details']);
392
393
        if ($params['refresh'] % 86400 === 0) {
394
            $refresh = $params['refresh']/86400 . 'd';
395
        } else if ($params['refresh'] % 3600 === 0) {
396
            $refresh = $params['refresh']/3600 . 'h';
397
        } else {
398
            $refresh = $params['refresh']/60 . 'm';
399
        }
400
401
        $node->attr('refresh', trim($refresh));
402
        $this->nodestack->add($node);
403
    }
404
405
406
    function footnote_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
407
    {
408
        $footnoteNode = new Node('footnote');
409
        $this->nodestack->addTop($footnoteNode);
410
        $this->nodestackBackup[] = $this->nodestack;
411
        $this->nodestack = new NodeStack();
412
413
    }
414
415
    function footnote_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
416
    {
417
        $json = json_encode($this->nodestack->doc());
418
        $this->nodestack = array_pop($this->nodestackBackup);
419
        $this->nodestack->current()->attr('contentJSON', $json);
420
        $this->nodestack->drop('footnote');
421
    }
422
423
    /**
424
     * @inheritDoc
425
     */
426
    function internalmedia(
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
427
        $src,
428
        $title = null,
429
        $align = null,
430
        $width = null,
431
        $height = null,
432
        $cache = null,
433
        $linking = null
434
    ) {
435
436
        // FIXME how do we handle non-images, e.g. pdfs or audio?
437
        \dokuwiki\plugin\prosemirror\parser\ImageNode::render(
438
            $this,
439
            $src,
440
            $title,
441
            $align,
442
            $width,
443
            $height,
444
            $cache,
445
            $linking
446
        );
447
    }
448
449
    /**
450
     * @inheritDoc
451
     */
452
    function externalmedia(
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
453
        $src,
454
        $title = null,
455
        $align = null,
456
        $width = null,
457
        $height = null,
458
        $cache = null,
459
        $linking = null
460
    ) {
461
        \dokuwiki\plugin\prosemirror\parser\ImageNode::render(
462
            $this,
463
            $src,
464
            $title,
465
            $align,
466
            $width,
467
            $height,
468
            $cache,
469
            $linking
470
        );
471
    }
472
473
474
    public function locallink($hash, $name = null)
475
    {
476
        \dokuwiki\plugin\prosemirror\parser\LocalLinkNode::render($this, $hash, $name);
477
    }
478
479
    /**
480
     * @inheritDoc
481
     */
482
    public function internallink($id, $name = null)
483
    {
484
        \dokuwiki\plugin\prosemirror\parser\InternalLinkNode::render($this, $id, $name);
485
    }
486
487
    public function externallink($link, $title = null)
488
    {
489
        \dokuwiki\plugin\prosemirror\parser\ExternalLinkNode::render($this, $link, $title);
490
    }
491
492
    public function interwikilink($link, $title = null, $wikiName, $wikiUri)
493
    {
494
        \dokuwiki\plugin\prosemirror\parser\InterwikiLinkNode::render($this, $title, $wikiName, $wikiUri);
495
    }
496
497
    public function emaillink($address, $name = null)
498
    {
499
        \dokuwiki\plugin\prosemirror\parser\EmailLinkNode::render($this, $address, $name);
500
    }
501
502
    public function windowssharelink($link, $title = null)
503
    {
504
        \dokuwiki\plugin\prosemirror\parser\WindowsShareLinkNode::render($this, $link, $title);
505
    }
506
507
    /** @inheritDoc */
508
    function linebreak()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
509
    {
510
        $this->nodestack->add(new Node('hard_break'));
511
    }
512
513
    /** @inheritDoc */
514
    function hr()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
515
    {
516
        $this->nodestack->add(new Node('horizontal_rule'));
517
    }
518
519
    function plugin($name, $data, $state = '', $match = '')
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
520
    {
521
        if (empty($match)) {
522
            return;
523
        }
524
        $eventData = [
525
            'name' => $name,
526
            'data' => $data,
527
            'state' => $state,
528
            'match' => $match,
529
            'renderer' => $this,
530
        ];
531
        $event = new Doku_Event('PROSEMIRROR_RENDER_PLUGIN', $eventData);
532
        if ($event->advise_before()) {
533
            if ($this->nodestack->current()->getType() === 'paragraph') {
534
                $nodetype = 'dwplugin_inline';
535
            } else {
536
                $nodetype = 'dwplugin_block';
537
            }
538
            $node = new Node($nodetype);
539
            $node->attr('class', 'dwplugin');
540
            $node->attr('data-pluginname', $name);
541
            $this->nodestack->addTop($node);
542
            $this->cdata($match);
543
            $this->nodestack->drop($nodetype);
544
        }
545
    }
546
547
    function smiley($smiley)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
548
    {
549
        if(array_key_exists($smiley, $this->smileys)) {
550
            $node = new Node('smiley');
551
            $node->attr('icon', $this->smileys[$smiley]);
552
            $node->attr('syntax', $smiley);
553
            $this->nodestack->add($node);
554
        } else {
555
            $this->cdata($smiley);
556
        }
557
    }
558
559
    #region elements with no special WYSIWYG representation
560
561
    /** @inheritDoc */
562
    function entity($entity)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
563
    {
564
        $this->cdata($entity); // FIXME should we handle them special?
565
    }
566
567
    /** @inheritDoc */
568
    function multiplyentity($x, $y)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
569
    {
570
        $this->cdata($x . 'x' . $y);
571
    }
572
573
    /** @inheritDoc */
574
    function acronym($acronym)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
575
    {
576
        $this->cdata($acronym);
577
    }
578
579
    /** @inheritDoc */
580
    function apostrophe()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
581
    {
582
        $this->cdata("'");
583
    }
584
585
    /** @inheritDoc */
586
    function singlequoteopening()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
587
    {
588
        $this->cdata("'");
589
    }
590
591
    /** @inheritDoc */
592
    function singlequoteclosing()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
593
    {
594
        $this->cdata("'");
595
    }
596
597
    /** @inheritDoc */
598
    function doublequoteopening()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
599
    {
600
        $this->cdata('"');
601
    }
602
603
    /** @inheritDoc */
604
    function doublequoteclosing()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
605
    {
606
        $this->cdata('"');
607
    }
608
609
    /** @inheritDoc */
610
    function camelcaselink($link)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
611
    {
612
        $this->cdata($link); // FIXME should/could we decorate it?
613
    }
614
615
    #endregion
616
617
    #region formatter marks
618
619
    /** @inheritDoc */
620
    function strong_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
621
    {
622
        $this->marks['strong'] = 1;
623
    }
624
625
    /** @inheritDoc */
626
    function strong_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
627
    {
628
        if (isset($this->marks['strong'])) {
629
            unset($this->marks['strong']);
630
        }
631
    }
632
633
    /** @inheritDoc */
634
    function emphasis_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
635
    {
636
        $this->marks['em'] = 1;
637
    }
638
639
    /** @inheritDoc */
640
    function emphasis_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
641
    {
642
        if (isset($this->marks['em'])) {
643
            unset($this->marks['em']);
644
        }
645
    }
646
647
    /** @inheritdoc */
648
    function subscript_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
649
    {
650
        $this->marks['subscript'] = 1;
651
    }
652
653
    /** @inheritDoc */
654
    function subscript_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
655
    {
656
        if (isset($this->marks['subscript'])) {
657
            unset($this->marks['subscript']);
658
        }
659
    }
660
661
    /** @inheritdoc */
662
    function superscript_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
663
    {
664
        $this->marks['superscript'] = 1;
665
    }
666
667
    /** @inheritDoc */
668
    function superscript_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
669
    {
670
        if (isset($this->marks['superscript'])) {
671
            unset($this->marks['superscript']);
672
        }
673
    }
674
675
    /** @inheritDoc */
676
    function monospace_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
677
    {
678
        $this->marks['code'] = 1;
679
    }
680
681
    /** @inheritDoc */
682
    function monospace_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
683
    {
684
        if (isset($this->marks['code'])) {
685
            unset($this->marks['code']);
686
        }
687
    }
688
689
    /** @inheritDoc */
690
    function deleted_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
691
    {
692
        $this->marks['deleted'] = 1;
693
    }
694
695
    /** @inheritDoc */
696
    function deleted_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
697
    {
698
        if (isset($this->marks['deleted'])) {
699
            unset($this->marks['deleted']);
700
        }
701
    }
702
703
    /** @inheritDoc */
704
    function underline_open()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
705
    {
706
        $this->marks['underline'] = 1;
707
    }
708
709
    /** @inheritDoc */
710
    function underline_close()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
711
    {
712
        if (isset($this->marks['underline'])) {
713
            unset($this->marks['underline']);
714
        }
715
    }
716
717
718
    /** @inheritDoc */
719
    function unformatted($text)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
720
    {
721
        $this->marks['unformatted'] = 1;
722
        parent::unformatted($text);
723
        unset($this->marks['unformatted']);
724
    }
725
726
727
    #endregion formatter marks
728
}
729