1
|
|
|
<?php |
2
|
|
|
namespace PSB\Core; |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
class MessageMutatorRegistry |
6
|
|
|
{ |
7
|
|
|
const INCOMING_LOGICAL = 0; |
8
|
|
|
const INCOMING_PHYSICAL = 1; |
9
|
|
|
const OUTGOING_LOGICAL = 2; |
10
|
|
|
const OUTGOING_PHYSICAL = 3; |
11
|
|
|
|
12
|
|
|
private $mutators = [ |
13
|
|
|
self::INCOMING_LOGICAL => [], |
14
|
|
|
self::INCOMING_PHYSICAL => [], |
15
|
|
|
self::OUTGOING_LOGICAL => [], |
16
|
|
|
self::OUTGOING_PHYSICAL => [], |
17
|
|
|
]; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @param string $mutatorContainerId |
21
|
|
|
*/ |
22
|
2 |
|
public function registerIncomingLogicalMessageMutator($mutatorContainerId) |
23
|
|
|
{ |
24
|
2 |
|
$this->mutators[self::INCOMING_LOGICAL][] = $mutatorContainerId; |
25
|
2 |
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $mutatorContainerId |
29
|
|
|
*/ |
30
|
2 |
|
public function registerIncomingPhysicalMessageMutator($mutatorContainerId) |
31
|
|
|
{ |
32
|
2 |
|
$this->mutators[self::INCOMING_PHYSICAL][] = $mutatorContainerId; |
33
|
2 |
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @param string $mutatorContainerId |
37
|
|
|
*/ |
38
|
2 |
|
public function registerOutgoingLogicalMessageMutator($mutatorContainerId) |
39
|
|
|
{ |
40
|
2 |
|
$this->mutators[self::OUTGOING_LOGICAL][] = $mutatorContainerId; |
41
|
2 |
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param string $mutatorContainerId |
45
|
|
|
*/ |
46
|
2 |
|
public function registerOutgoingPhysicalMessageMutator($mutatorContainerId) |
47
|
|
|
{ |
48
|
2 |
|
$this->mutators[self::OUTGOING_PHYSICAL][] = $mutatorContainerId; |
49
|
2 |
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return array |
53
|
|
|
*/ |
54
|
2 |
|
public function getIncomingLogicalMessageMutatorIds() |
55
|
|
|
{ |
56
|
2 |
|
return array_unique($this->mutators[self::INCOMING_LOGICAL]); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return array |
61
|
|
|
*/ |
62
|
2 |
|
public function getIncomingPhysicalMessageMutatorIds() |
63
|
|
|
{ |
64
|
2 |
|
return array_unique($this->mutators[self::INCOMING_PHYSICAL]); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return array |
69
|
|
|
*/ |
70
|
2 |
|
public function getOutgoingLogicalMessageMutatorIds() |
71
|
|
|
{ |
72
|
2 |
|
return array_unique($this->mutators[self::OUTGOING_LOGICAL]); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return array |
77
|
|
|
*/ |
78
|
2 |
|
public function getOutgoingPhysicalMessageMutatorIds() |
79
|
|
|
{ |
80
|
2 |
|
return array_unique($this->mutators[self::OUTGOING_PHYSICAL]); |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
|