public function close() { if ($this->closed) { return; } $this->closed = true; $this->emit('close'); $this->removeAllListeners(); $this->connection->close(); }
/** * Handles the given data. * * @param string $data Consumed data * @param string $consumer Command to execute * @param ConnectionInterface $connection The connection to the producer * * @return void */ public function handleData($data, $consumer, ConnectionInterface $connection, $callback = null) { $command = sprintf('%s "%s"', $consumer, addslashes($data)); if ($callback && is_callable($callback)) { call_user_func($callback, $data); } $this->processFactory->newProcess($command)->run(); $connection->close(); }