Passed
Push — master ( eabfa3...2db6fa )
by Petr
04:00
created

CreateBand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 32
ccs 0
cts 6
cp 0
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate() 0 8 2
1
<?php
2
3
namespace AppBundle\Entity\DTO;
4
5
use Symfony\Component\Validator\Constraints as Assert;
6
use Symfony\Component\Validator\Context\ExecutionContextInterface;
7
8
/**
9
 * @author Vehsamrak
10
 */
11
class CreateBand
12
{
13
    /**
14
     * @var string
15
     * @Assert\NotBlank(message="Parameter is mandatory: name.")
16
     */
17
    public $name;
18
19
    /**
20
     * @var string
21
     * @Assert\NotBlank(message="Parameter is mandatory: description.")
22
     */
23
    public $description;
24
25
    /**
26
     * @var string[]
27
     * @Assert\NotBlank(message="Parameter is mandatory: members.")
28
     */
29
    public $members;
30
31
    /**
32
     * @Assert\Callback
33
     */
34
    public function validate(ExecutionContextInterface $context)
35
    {
36
        if (!is_array($this->members)) {
37
            $context->buildViolation('Members must be an array.')
38
                    ->atPath('members')
39
                    ->addViolation();
40
        }
41
    }
42
}
43