Total Complexity | 5 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
19 | class FeatureColumns extends AbstractFeature |
||
20 | { |
||
21 | /** |
||
22 | * @Groups({"component", "content"}) |
||
23 | * @var int |
||
24 | */ |
||
25 | protected $columns = 3; |
||
26 | |||
27 | /** |
||
28 | * @Groups({"component", "content"}) |
||
29 | * @var null|string |
||
30 | */ |
||
31 | protected $title; |
||
32 | |||
33 | /** |
||
34 | * @param ClassMetadata $metadata |
||
35 | */ |
||
36 | 1 | public static function loadValidatorMetadata(ClassMetadata $metadata): void |
|
37 | { |
||
38 | 1 | $metadata->addPropertyConstraint( |
|
39 | 1 | 'columns', |
|
40 | 1 | new Assert\Range( |
|
41 | [ |
||
42 | 1 | 'min' => 1, |
|
43 | 'minMessage' => 'The FeatureColumns component must have at least 1 column' |
||
44 | ] |
||
45 | ) |
||
46 | ); |
||
47 | 1 | } |
|
48 | |||
49 | /** |
||
50 | * @return int |
||
51 | */ |
||
52 | 1 | public function getColumns(): int |
|
53 | { |
||
54 | 1 | return $this->columns; |
|
55 | } |
||
56 | |||
57 | /** |
||
58 | * @param int $columns |
||
59 | */ |
||
60 | 1 | public function setColumns(int $columns): void |
|
61 | { |
||
62 | 1 | $this->columns = $columns; |
|
63 | 1 | } |
|
64 | |||
65 | /** |
||
66 | * @return null|string |
||
67 | */ |
||
68 | 1 | public function getTitle(): ?string |
|
69 | { |
||
70 | 1 | return $this->title; |
|
71 | } |
||
72 | |||
73 | /** |
||
74 | * @param null|string $title |
||
75 | */ |
||
76 | 1 | public function setTitle(?string $title): void |
|
79 | 1 | } |
|
80 | } |
||
81 |