EntityExist   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 14
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Happyr\Validator\Constraint;
6
7
use Symfony\Component\Validator\Constraint;
8
9
/**
10
 * @Annotation
11
 *
12
 * @author Radoje Albijanic <[email protected]>
13
 */
14
#[\Attribute(\Attribute::TARGET_PROPERTY)]
15
final class EntityExist extends Constraint
16
{
17
    public $message = 'Entity "%entity%" with property "%property%": "%value%" does not exist.';
18
    public $property = 'id';
19
    public $entity;
20
21
    public function __construct($entity = null, $property = null, $message = null, $options = null, array $groups = null, $payload = null)
22
    {
23
        parent::__construct($options, $groups, $payload);
24
25
        $this->entity = $entity ?? $this->entity;
26
        $this->property = $property ?? $this->property;
27
        $this->message = $message ?? $this->message;
28
    }
29
}
30