AbstractXmlMapper   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 4
dl 0
loc 16
c 0
b 0
f 0
rs 10
ccs 6
cts 6
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A data() 0 2 1
A attributes() 0 2 1
A cdata() 0 2 2
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