Completed
Push — master ( 203e38...2cdd54 )
by Gerrit
13:04
created

CallDefinition   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 1
dl 0
loc 51
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 16 2
A getObjectReference() 0 4 1
A getRoutineName() 0 4 1
A getArgumentMappings() 0 4 1
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