public function getData() { switch ($this->type) { case OpcodeEnum::ERROR: return $this->getErrorData(); case OpcodeEnum::READY: /** * Indicates that the server is ready to process queries. This message will be * sent by the server either after a STARTUP message if no authentication is * required, or after a successful CREDENTIALS message. */ return null; case OpcodeEnum::AUTHENTICATE: return unpack('n', $this->binary)[1]; case OpcodeEnum::SUPPORTED: /** * TODO Check it! * Indicates which startup options are supported by the server. This message * comes as a response to an OPTIONS message. * * The body of a SUPPORTED message is a [string multimap]. This multimap gives * for each of the supported STARTUP options, the list of supported values. */ return $this->dataStream->readByType(['type' => DataTypeEnum::COLLECTION_MAP]); case OpcodeEnum::RESULT: return $this->getResultData(); case OpcodeEnum::EVENT: // TODO return ''; default: throw new ResponseException('Unknown response'); } }