CourseMapping   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 32
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 4 1
A getFactory() 0 4 1
A getPropertyMappings() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiSkeleton\Deserialization;
6
7
use Chubbyphp\ApiSkeleton\Model\Document;
8
use Chubbyphp\Deserialization\Mapping\ObjectMappingInterface;
9
use Chubbyphp\Deserialization\Mapping\PropertyMapping;
10
use Chubbyphp\Deserialization\Mapping\PropertyMappingInterface;
11
use Chubbyphp\ApiSkeleton\Model\Course;
12
use Chubbyphp\DeserializationModel\Deserializer\PropertyModelCollectionDeserializer;
13
14
final class CourseMapping implements ObjectMappingInterface
15
{
16
    /**
17
     * @return string
18
     */
19 1
    public function getClass(): string
20
    {
21 1
        return Course::class;
22
    }
23
24
    /**
25
     * @return callable
26
     */
27 1
    public function getFactory(): callable
28
    {
29 1
        return [Course::class, 'create'];
30
    }
31
32
    /**
33
     * @return PropertyMappingInterface[]
34
     */
35 1
    public function getPropertyMappings(): array
36
    {
37
        return [
38 1
            new PropertyMapping('name'),
39 1
            new PropertyMapping('level'),
40 1
            new PropertyMapping('progress'),
41 1
            new PropertyMapping('active'),
42 1
            new PropertyMapping('documents', new PropertyModelCollectionDeserializer(Document::class, true)),
43
        ];
44
    }
45
}
46