Passed
Push — master ( 4959cd...65a92c )
by Marcel
17:47
created

UniqueId   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
c 0
b 0
f 0
dl 0
loc 14
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
1
<?php
2
3
namespace App\Validator;
4
5
use Attribute;
6
use Symfony\Component\Validator\Constraint;
7
8
#[Attribute]
9
class UniqueId extends Constraint {
10
    /**
11
     * @var string
12
     */
13
    public string $propertyPath;
14
15
    public string $message = 'Id {{ id }} is used more than once. All ids must be unique.';
16
17
    public function __construct(mixed $options = null, array $groups = null, mixed $payload = null, ?string $propertyPath = null) {
18
        parent::__construct($options, $groups, $payload);
19
20
        if(!empty($propertyPath)) {
21
            $this->propertyPath = $propertyPath;
22
        }
23
    }
24
}