/** * 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()); }
/** * 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); }
/** * 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()); }
public function testStripRoutingInformationRemovesItFromTheMainMessage() { $msg = new Message(array('worker1', '', 'hello', 'world')); $msg->stripRoutingInformation(); $this->assertSame(array('hello', 'world'), $msg->toArray()); }