Completed
Push — feature/resolve-parent-class ( 1a8a55...248da8 )
by Colin
35:17 queued 33:54
created

AbstractInline::getData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
/*
4
 * This file is part of the league/commonmark package.
5
 *
6
 * (c) Colin O'Dell <[email protected]>
7
 *
8
 * Original code based on the CommonMark JS reference parser (https://bitly.com/commonmark-js)
9
 *  - (c) John MacFarlane
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
namespace League\CommonMark\Inline\Element;
16
17
use League\CommonMark\Node\Node;
18
19
/**
20
 * @method children() AbstractInline[]
21
 */
22
abstract class AbstractInline extends Node
23
{
24
    /**
25
     * @var array
26
     *
27
     * Used for storage of arbitrary data
28
     */
29
    public $data = [];
30
31
    /**
32
     * @return bool
33
     */
34 219
    public function isContainer(): bool
35
    {
36 219
        return false;
37
    }
38
39
    /**
40
     * @param string $key
41
     * @param mixed  $default
42
     *
43
     * @return mixed
44
     */
45 1026
    public function getData(string $key, $default = null)
46
    {
47 1026
        return isset($this->data[$key]) ? $this->data[$key] : $default;
48
    }
49
}
50