-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Negotiations.php
45 lines (36 loc) · 925 Bytes
/
Negotiations.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
<?php declare(strict_types = 1);
namespace Apitte\Core\Annotation\Controller;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Doctrine\Common\Annotations\Annotation\Target;
use Doctrine\Common\Annotations\AnnotationException;
/**
* @Annotation
* @Target("METHOD")
* @NamedArgumentConstructor()
*/
class Negotiations
{
/** @var Negotiation[] */
private array $negotiations = [];
/**
* @param Negotiation[]|Negotiation $negotiations
*/
public function __construct(array|Negotiation $negotiations)
{
if (empty($negotiations)) {
throw new AnnotationException('Empty @Negotiations given');
}
// Wrap single given request parameter into array
if (!is_array($negotiations)) {
$negotiations = [$negotiations];
}
$this->negotiations = $negotiations;
}
/**
* @return Negotiation[]
*/
public function getNegotiations(): array
{
return $this->negotiations;
}
}