Total Complexity | 5 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | trait AtMemberManager { |
||
9 | /** @var array */ |
||
10 | protected $atMembers = []; |
||
11 | |||
12 | /** |
||
13 | * human api |
||
14 | */ |
||
15 | |||
16 | /** |
||
17 | * spec api |
||
18 | */ |
||
19 | |||
20 | /** |
||
21 | * @param string $key |
||
22 | * @param mixed $value |
||
23 | */ |
||
24 | 12 | public function addAtMember($key, $value) { |
|
25 | 12 | if (strpos($key, '@') === 0) { |
|
26 | 2 | $key = substr($key, 1); |
|
27 | } |
||
28 | |||
29 | 12 | Validator::checkMemberName($key); |
|
30 | |||
31 | 11 | if (is_object($value)) { |
|
32 | 1 | $value = Converter::objectToArray($value); |
|
33 | } |
||
34 | |||
35 | 11 | $this->atMembers['@'.$key] = $value; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * internal api |
||
40 | */ |
||
41 | |||
42 | /** |
||
43 | * @internal |
||
44 | * |
||
45 | * @return boolean |
||
46 | */ |
||
47 | 184 | public function hasAtMembers() { |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * @internal |
||
53 | * |
||
54 | * @return array |
||
55 | */ |
||
56 | 5 | public function getAtMembers() { |
|
60 |