DocumentMapping::getClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 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