1 | <?php |
||
23 | abstract class AbstractOobHandler implements IoHandlerInterface |
||
24 | { |
||
25 | /** |
||
26 | * Operation to descriptor state map |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | private static $stateMap = [ |
||
31 | OperationInterface::OPERATION_READ => RequestDescriptor::RDS_READ, |
||
32 | OperationInterface::OPERATION_WRITE => RequestDescriptor::RDS_WRITE, |
||
33 | ]; |
||
34 | |||
35 | /** |
||
36 | * {@inheritdoc} |
||
37 | */ |
||
38 | 100 | final public function handle( |
|
77 | |||
78 | /** |
||
79 | * Return state which should invoke this operation |
||
80 | * |
||
81 | * @param OperationInterface $operation Operation object |
||
82 | * |
||
83 | * @return int RequestDescriptor::RDS_* constant |
||
84 | */ |
||
85 | 95 | private function getInvokeState(OperationInterface $operation) |
|
91 | |||
92 | /** |
||
93 | * Process given operation |
||
94 | * |
||
95 | * @param RequestDescriptor $descriptor Request descriptor |
||
96 | * @param RequestExecutorInterface $executor Executor, processing operation |
||
97 | * @param EventHandlerInterface $eventHandler Event handler for this operation |
||
98 | * |
||
99 | * @return OperationInterface|null Next operation to pass in socket. Return null, |
||
100 | * if next operation is not required. Return $operation parameter, if operation is not completed yet |
||
101 | */ |
||
102 | abstract protected function handleOperation( |
||
107 | } |
||
108 |