コード例 #1
0
ファイル: Client.php プロジェクト: toohamster/phpque
 /**
  * @param $command
  * @param array $arguments
  * @return mixed
  * @throws ConnectionException
  * @throws ResponseException
  * @throws TransportException
  */
 protected function send($command, $arguments = array())
 {
     if (!$this->isConnected) {
         $this->connect();
     }
     $request = $this->serializer->serialize($command, $arguments);
     $result = fwrite($this->stream, $request);
     if ($result === false) {
         throw new TransportException("Unable to send command to node {$this->nodeId}");
     }
     $response = $this->responseReader->getResponse($this->stream);
     return $response;
 }
コード例 #2
0
ファイル: SerializerTest.php プロジェクト: toohamster/phpque
 /**
  * @param string $command
  * @param array $arguments
  * @param string $expected
  * @dataProvider dataTestSerialize
  */
 public function testSerialize($command, array $arguments, $expected)
 {
     $this->assertEquals($expected, $this->service->serialize($command, $arguments));
 }