Changeset View
Changeset View
Standalone View
Standalone View
src/hgdaemon/ArcanistHgClientChannel.php
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | /* -( Protocol Implementation )-------------------------------------------- */ | ||||
| * | * | ||||
| * @param pair<string,string> The <channel, data> pair to encode. | * @param pair<string,string> The <channel, data> pair to encode. | ||||
| * @return string Encoded string for transmission to the client. | * @return string Encoded string for transmission to the client. | ||||
| * | * | ||||
| * @task protocol | * @task protocol | ||||
| */ | */ | ||||
| protected function encodeMessage($argv) { | protected function encodeMessage($argv) { | ||||
| if (!is_array($argv) || count($argv) !== 2) { | if (!is_array($argv) || count($argv) !== 2) { | ||||
| throw new Exception("Message should be <channel, data>."); | throw new Exception('Message should be <channel, data>.'); | ||||
| } | } | ||||
| $channel = head($argv); | $channel = head($argv); | ||||
| $data = last($argv); | $data = last($argv); | ||||
| $len = strlen($data); | $len = strlen($data); | ||||
| $len = pack('N', $len); | $len = pack('N', $len); | ||||
| ▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines | |||||