本文整理汇总了PHP中ZMQSocket::getSocketType方法的典型用法代码示例。如果您正苦于以下问题:PHP ZMQSocket::getSocketType方法的具体用法?PHP ZMQSocket::getSocketType怎么用?PHP ZMQSocket::getSocketType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZMQSocket
的用法示例。
在下文中一共展示了ZMQSocket::getSocketType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(\ZMQSocket $socket)
{
if ($socket->getSocketType() !== \ZMQ::SOCKET_REP) {
throw new \InvalidArgumentException('Invalid socket type. REP required');
}
$this->socket = $socket;
}
示例2: wrapSocket
/**
* @param RawZMQSocket $socket
* @return ZmqSocket
*/
private function wrapSocket(RawZMQSocket $socket)
{
$wrapped = new ZmqSocket($socket, $this->loop);
if ($this->isReadableSocketType($socket->getSocketType())) {
$wrapped->attachReadListener();
}
return $wrapped;
}
示例3: handlesDeferred
/**
* @return bool
*/
public function handlesDeferred()
{
return $this->socket->getSocketType() === \ZMQ::SOCKET_REQ;
}
示例4: isSocketTypeWaitingForReply
/**
* @param \ZMQSocket $socket
*
* @return bool
*/
protected function isSocketTypeWaitingForReply(\ZMQSocket $socket)
{
switch ($socket->getSocketType()) {
case \ZMQ::SOCKET_REP:
return true;
default:
return false;
}
}
示例5: getContextMock
private function getContextMock($methods = array(), \ZMQSocket $socket = null)
{
$context = $this->getMockBuilder('\\ZMQContext')->setConstructorArgs(array(1, $socket->isPersistent()))->setMethods($methods)->getMock();
if ($socket) {
$context->expects($this->any())->method('getSocket')->with($this->equalTo($socket->getSocketType()), $socket->isPersistent() ? $this->isType('string') : $this->isNull(), $this->isType('callable'))->will($this->returnCallback(function ($socketType, $persistentId, $callback) use($socket) {
call_user_func($callback, $socket);
return $socket;
}));
}
return $context;
}