1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the slince/spike package. |
5
|
|
|
* |
6
|
|
|
* (c) Slince <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Spike\Server\Event; |
13
|
|
|
|
14
|
|
|
use React\Socket\ConnectionInterface; |
15
|
|
|
use Slince\Event\Event; |
16
|
|
|
use Spike\Common\Protocol\SpikeInterface; |
17
|
|
|
use Spike\Server\Handler\ActionHandlerInterface; |
18
|
|
|
|
19
|
|
|
class FilterActionHandlerEvent extends Event |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var SpikeInterface |
23
|
|
|
*/ |
24
|
|
|
protected $message; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var ConnectionInterface |
28
|
|
|
*/ |
29
|
|
|
protected $connection; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var ActionHandlerInterface |
33
|
|
|
*/ |
34
|
|
|
protected $actionHandler; |
35
|
|
|
|
36
|
|
|
public function __construct($subject, SpikeInterface $message, ConnectionInterface $connection) |
37
|
|
|
{ |
38
|
|
|
$this->message = $message; |
39
|
|
|
$this->connection = $connection; |
40
|
|
|
parent::__construct(Events::SERVER_ACTION, $subject); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @return SpikeInterface |
45
|
|
|
*/ |
46
|
|
|
public function getMessage() |
47
|
|
|
{ |
48
|
|
|
return $this->message; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @return ConnectionInterface |
53
|
|
|
*/ |
54
|
|
|
public function getConnection() |
55
|
|
|
{ |
56
|
|
|
return $this->connection; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @param ActionHandlerInterface $actionHandler |
61
|
|
|
*/ |
62
|
|
|
public function setActionHandler($actionHandler) |
63
|
|
|
{ |
64
|
|
|
$this->actionHandler = $actionHandler; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return ActionHandlerInterface |
69
|
|
|
*/ |
70
|
|
|
public function getActionHandler() |
71
|
|
|
{ |
72
|
|
|
return $this->actionHandler; |
73
|
|
|
} |
74
|
|
|
} |