AbstractXmlMapper::data()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 2
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace KingsonDe\Marshal;
6
7
/**
8
 * Concrete Mapper classes MUST implement a "map" function that must return an array or null.
9
 * The reason of not having an abstract function for the "map" function is type hinting.
10
 */
11
class AbstractXmlMapper extends AbstractMapper {
12
13 1
    protected function attributes(): string {
14 1
        return MarshalXml::ATTRIBUTES_KEY;
15
    }
16
17 1
    protected function data(): string {
18 1
        return MarshalXml::DATA_KEY;
19
    }
20
21 1
    /**
22 1
     * @param mixed $data
23
     * @return array|string
24
     */
25
    protected function cdata($data = null) {
26
        return ($data ? [MarshalXml::CDATA_KEY => $data] : MarshalXml::CDATA_KEY);
27
    }
28
}
29