|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (C) 2018 Gerrit Addiks. |
|
4
|
|
|
* This package (including this file) was released under the terms of the GPL-3.0. |
|
5
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
|
6
|
|
|
* If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy. |
|
7
|
|
|
* |
|
8
|
|
|
* @license GPL-3.0 |
|
9
|
|
|
* |
|
10
|
|
|
* @author Gerrit Addiks <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Addiks\RDMBundle\Mapping; |
|
14
|
|
|
|
|
15
|
|
|
use Addiks\RDMBundle\Mapping\CallDefinitionInterface; |
|
16
|
|
|
use Addiks\RDMBundle\Mapping\MappingInterface; |
|
17
|
|
|
use Webmozart\Assert\Assert; |
|
18
|
|
|
|
|
19
|
|
|
final class CallDefinition implements CallDefinitionInterface |
|
20
|
|
|
{ |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @var string|null |
|
24
|
|
|
*/ |
|
25
|
|
|
private $objectReference; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
private $routineName; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var array<MappingInterface> |
|
34
|
|
|
*/ |
|
35
|
|
|
private $argumentMappings = array(); |
|
36
|
|
|
|
|
37
|
4 |
|
public function __construct( |
|
38
|
|
|
string $routineName, |
|
39
|
|
|
string $objectReference = null, |
|
40
|
|
|
array $argumentMappings = array() |
|
41
|
|
|
) { |
|
42
|
4 |
|
$this->routineName = $routineName; |
|
43
|
4 |
|
$this->objectReference = $objectReference; |
|
44
|
|
|
|
|
45
|
4 |
|
foreach ($argumentMappings as $argumentMapping) { |
|
46
|
|
|
/** @var MappingInterface $argumentMapping */ |
|
47
|
|
|
|
|
48
|
4 |
|
Assert::isInstanceOf($argumentMapping, MappingInterface::class); |
|
49
|
|
|
|
|
50
|
4 |
|
$this->argumentMappings[] = $argumentMapping; |
|
51
|
|
|
} |
|
52
|
4 |
|
} |
|
53
|
|
|
|
|
54
|
1 |
|
public function getObjectReference(): ?string |
|
55
|
|
|
{ |
|
56
|
1 |
|
return $this->objectReference; |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
1 |
|
public function getRoutineName(): string |
|
60
|
|
|
{ |
|
61
|
1 |
|
return $this->routineName; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
1 |
|
public function getArgumentMappings(): array |
|
65
|
|
|
{ |
|
66
|
1 |
|
return $this->argumentMappings; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
} |
|
70
|
|
|
|