-
Notifications
You must be signed in to change notification settings - Fork 0
/
Prototype.php
81 lines (69 loc) · 1.9 KB
/
Prototype.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
<?php
/*
* This file is part of the prooph software processing toolbox.
* (c) 2014-2015 prooph software GmbH <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* Date: 09.07.14 - 21:34
*/
namespace Prooph\Done\Process\Type;
use Assert\Assertion;
use Prooph\Done\Process\Type\Description\Description;
/**
* Class Prototype
*
* @package Prooph\Done\Process\Type
* @author Alexander Miertsch <[email protected]>
*/
class Prototype
{
/**
* @var string
*/
protected $relatedTypeClass;
/**
* @var Description
*/
protected $descriptionOfType;
/**
* @var PrototypeProperty[propertyName => PrototypeProperty]
*/
protected $typeProperties;
/**
* @param string $relatedTypeClass
* @param Description $descriptionOfType
* @param PrototypeProperty[] $typeProperties
*/
public function __construct($relatedTypeClass, Description $descriptionOfType, array $typeProperties)
{
Assertion::implementsInterface($relatedTypeClass, 'Prooph\Done\Process\\Type\Type');
foreach($typeProperties as $propertyOfType) Assertion::isInstanceOf($propertyOfType, 'Prooph\Done\Process\Type\PrototypeProperty');
$this->relatedTypeClass = $relatedTypeClass;
$this->descriptionOfType = $descriptionOfType;
$this->typeProperties = $typeProperties;
PrototypeRegistry::registerPrototype($this);
}
/**
* @return string class name of the related type
*/
public function of()
{
return $this->relatedTypeClass;
}
/**
* @return Description
*/
public function typeDescription()
{
return $this->descriptionOfType;
}
/**
* @return PrototypeProperty[]
*/
public function typeProperties()
{
return $this->typeProperties;
}
}