Test Failed
Push — master ( 044337...2079fc )
by Dominik
04:49
created

DocumentMapping::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    public function getClass(): string
21
    {
22
        return Document::class;
23
    }
24
25
    /**
26
     * @return ConstraintInterface[]
27
     */
28
    public function getConstraints(): array
29
    {
30
        return [];
31
    }
32
33
    /**
34
     * @return PropertyMappingInterface[]
35
     */
36
    public function getPropertyMappings(): array
37
    {
38
        return [
39
            new PropertyMapping('name', [new NotNullConstraint(), new NotBlankConstraint()]),
40
            new PropertyMapping('url', [new NotNullConstraint(), new NotBlankConstraint()]),
41
        ];
42
    }
43
}
44