-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dto.php
103 lines (78 loc) · 2.25 KB
/
Dto.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
namespace Artyum\RequestDtoMapperBundle\Attribute;
use Attribute;
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_METHOD | Attribute::TARGET_PARAMETER)]
class Dto
{
private array $methods;
public function __construct(
private ?string $extractor = null, private ?string $subject = null, array|string $methods = [],
private array $denormalizerOptions = [], private ?bool $validate = null, private array $validationGroups = [],
private ?bool $throwOnViolation = null
) {
$this->methods = is_array($methods) ? $methods : [$methods];
}
public function getExtractor(): ?string
{
return $this->extractor;
}
public function setExtractor(?string $extractor): self
{
$this->extractor = $extractor;
return $this;
}
public function getSubject(): ?string
{
return $this->subject;
}
public function setSubject(string $subject): self
{
$this->subject = $subject;
return $this;
}
public function getMethods(): array
{
return $this->methods;
}
public function setMethods(array|string $methods): self
{
$this->methods = is_array($methods) ? $methods : [$methods];
return $this;
}
public function getDenormalizerOptions(): array
{
return $this->denormalizerOptions;
}
public function setDenormalizerOptions(array $denormalizerOptions): self
{
$this->denormalizerOptions = $denormalizerOptions;
return $this;
}
public function getValidate(): ?bool
{
return $this->validate;
}
public function setValidate(?bool $validate): self
{
$this->validate = $validate;
return $this;
}
public function getValidationGroups(): array
{
return $this->validationGroups;
}
public function setValidationGroups(array $validationGroups): self
{
$this->validationGroups = $validationGroups;
return $this;
}
public function getThrowOnViolation(): ?bool
{
return $this->throwOnViolation;
}
public function setThrowOnViolation(?bool $throwOnViolation): self
{
$this->throwOnViolation = $throwOnViolation;
return $this;
}
}