DocumentMapping   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getClass() 0 4 1
A getConstraints() 0 4 1
A getPropertyMappings() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chubbyphp\ApiSkeleton\Validation;
6
7
use Chubbyphp\Validation\Constraint\ConstraintInterface;
8
use Chubbyphp\Validation\Constraint\NotBlankConstraint;
9
use Chubbyphp\Validation\Constraint\NotNullConstraint;
10
use Chubbyphp\Validation\Mapping\ObjectMappingInterface;
11
use Chubbyphp\Validation\Mapping\PropertyMapping;
12
use Chubbyphp\Validation\Mapping\PropertyMappingInterface;
13
use Chubbyphp\ApiSkeleton\Model\Document;
14
15
final class DocumentMapping implements ObjectMappingInterface
16
{
17
    /**
18
     * @return string
19
     */
20 1
    public function getClass(): string
21
    {
22 1
        return Document::class;
23
    }
24
25
    /**
26
     * @return ConstraintInterface[]
27
     */
28 1
    public function getConstraints(): array
29
    {
30 1
        return [];
31
    }
32
33
    /**
34
     * @return PropertyMappingInterface[]
35
     */
36 1
    public function getPropertyMappings(): array
37
    {
38
        return [
39 1
            new PropertyMapping('name', [new NotNullConstraint(), new NotBlankConstraint()]),
40 1
            new PropertyMapping('url', [new NotNullConstraint(), new NotBlankConstraint()]),
41
        ];
42
    }
43
}
44