Total Complexity | 6 |
Total Lines | 56 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | class Mark implements \JsonSerializable |
||
12 | { |
||
13 | /** @var string The type of this mark */ |
||
14 | protected $type; |
||
15 | |||
16 | /** @var array The attributes associated with this mark */ |
||
17 | protected $attrs = []; |
||
18 | |||
19 | /** |
||
20 | * Mark constructor. |
||
21 | * |
||
22 | * @param string $type |
||
23 | */ |
||
24 | public function __construct($type) |
||
25 | { |
||
26 | $this->type = $type; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param string $key Attribute key to get or set |
||
31 | * @param null $value Attribute value to set, null to get |
||
|
|||
32 | * |
||
33 | * @return $this|mixed Either the wanted value or the Mark itself |
||
34 | */ |
||
35 | public function attr($key, $value = null) |
||
47 | } |
||
48 | |||
49 | /** |
||
50 | * Specify data which should be serialized to JSON |
||
51 | * |
||
52 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
53 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
54 | * which is a value of any type other than a resource. |
||
55 | * @since 5.4.0 |
||
56 | */ |
||
57 | public function jsonSerialize() |
||
69 |