Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
70.00% covered (warning)
70.00%
14 / 20
50.00% covered (danger)
50.00%
5 / 10
CRAP
0.00% covered (danger)
0.00%
0 / 1
ClassMetadata
70.00% covered (warning)
70.00%
14 / 20
50.00% covered (danger)
50.00%
5 / 10
12.70
0.00% covered (danger)
0.00%
0 / 1
 getClass
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setClass
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getParentClass
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setParentClass
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getLabel
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setLabel
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 getMetaData
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 setMetaData
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 addMetaData
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 jsonSerialize
100.00% covered (success)
100.00%
6 / 6
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3/**
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; under version 2
7 * of the License (non-upgradable).
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 *
18 * Copyright (c) 2020 (original work) Open Assessment Technologies SA;
19 *
20 */
21
22declare(strict_types=1);
23
24namespace oat\tao\model\Lists\Business\Domain;
25
26use JsonSerializable;
27
28class ClassMetadata implements JsonSerializable
29{
30    /** @var string */
31    private $class;
32
33    /** @var string|null */
34    private $parentClass;
35
36    /** @var string */
37    private $label;
38
39    /** @var MetadataCollection */
40    private $metaData;
41
42    public function getClass(): string
43    {
44        return $this->class;
45    }
46
47    public function setClass(string $class): ClassMetadata
48    {
49        $this->class = $class;
50
51        return $this;
52    }
53
54    public function getParentClass(): ?string
55    {
56        return $this->parentClass;
57    }
58
59    public function setParentClass(?string $parentClass): ClassMetadata
60    {
61        $this->parentClass = $parentClass;
62
63        return $this;
64    }
65
66    public function getLabel(): string
67    {
68        return $this->label;
69    }
70
71    public function setLabel(string $label): ClassMetadata
72    {
73        $this->label = $label;
74
75        return $this;
76    }
77
78    public function getMetaData(): ?MetadataCollection
79    {
80        return $this->metaData;
81    }
82
83    public function setMetaData(MetadataCollection $metaData): ClassMetadata
84    {
85        $this->metaData = $metaData;
86
87        return $this;
88    }
89
90    public function addMetaData(Metadata $metaData): ClassMetadata
91    {
92        $this->metaData->addMetadata($metaData);
93
94        return $this;
95    }
96
97    public function jsonSerialize(): array
98    {
99        return [
100            'class' => $this->class,
101            'parent-class' => $this->parentClass,
102            'label' => $this->label,
103            'metadata' => $this->metaData,
104        ];
105    }
106}