processor = $processor; $this->serverTransport = $serverTransport; $this->transportFactory = $transportFactory; $this->protocolFactory = $protocolFactory; $this->serverEventHandler = null; } protected function _clientBegin(TProtocol $prot): void { if ($this->serverEventHandler) { $this->serverEventHandler->clientBegin($prot); } } protected function handle(TBufferedTransport $client): bool { $trans = $this->transportFactory->getTransport($client); $prot = $this->protocolFactory->getProtocol($trans); $this->_clientBegin($prot); try { $this->processor->process($prot, $prot); } catch (TTransportException $tx) { // ignore return false; } catch (Exception $x) { echo 'Handle caught transport exception: '.$x->getMessage()."\n"; return false; } $trans->close(); return true; } public abstract function serve(): void; }