예제 #1
0
 /**
  * Creates a FetchAction message from the Message.
  *
  * @param \AlphaRPC\Common\Socket\Message $msg
  *
  * @throws InvalidArgumentException
  *
  * @return self
  */
 public static function fromMessage(Message $msg)
 {
     $count = $msg->shift();
     if ($count != $msg->count()) {
         throw new InvalidArgumentException('The action count is not the same as the actual number of actions.');
     }
     return new self($msg->toArray());
 }
예제 #2
0
 /**
  * Creates a ActionResponse message from the Message.
  *
  * @param \AlphaRPC\Common\Socket\Message $msg
  *
  * @return StorageStatus
  */
 public static function fromMessage(Message $msg)
 {
     return new self($msg->toArray());
 }
 /**
  * Creates an instance from the Message.
  *
  * @param Message $msg
  *
  * @return ClientHandlerJobRequest
  */
 public static function fromMessage(Message $msg)
 {
     $requestId = $msg->shift();
     $actionName = $msg->shift();
     $parameters = $msg->toArray();
     return new self($requestId, $actionName, $parameters);
 }
예제 #4
0
 /**
  * Creates a FetchAction message from the Message.
  *
  * @param \AlphaRPC\Common\Socket\Message $msg
  *
  * @return StorageStatus
  */
 public static function fromMessage(Message $msg)
 {
     return new static($msg->shift(), $msg->shift(), $msg->toArray());
 }
예제 #5
0
 public function testStripRoutingInformationRemovesItFromTheMainMessage()
 {
     $msg = new Message(array('worker1', '', 'hello', 'world'));
     $msg->stripRoutingInformation();
     $this->assertSame(array('hello', 'world'), $msg->toArray());
 }