Convert comments to phpdoc

This commit is contained in:
2021-01-30 18:26:31 +03:00
parent e1cca2d3eb
commit 930314f1ac
2 changed files with 74 additions and 28 deletions

View File

@@ -18,23 +18,32 @@ use function gethostname;
*/ */
final class ClientConfig implements JsonSerializable final class ClientConfig implements JsonSerializable
{ {
/** @psalm-suppress ImpureFunctionCall */ /**
* @psalm-suppress ImpureFunctionCall
*/
public function __construct( public function __construct(
/* /**
* The secret used for authorization, if the server requires it. This value will be ignored if the server * The secret used for authorization, if the server requires it. This value will be ignored if the server
* does not require authorization. * does not require authorization.
*/ */
public ?string $authSecret = null, public ?string $authSecret = null,
// The timeout for establishing a connection in seconds. /**
* The timeout for establishing a connection in seconds.
*/
public int $connectTimeout = 10, public int $connectTimeout = 10,
// An identifier used to disambiguate this client (i.e. something specific to the consumer) /**
* An identifier used to disambiguate this client (i.e. something specific to the consumer).
*/
public string $clientId = '', public string $clientId = '',
// Enable deflate compression for this connection. A client cannot enable both [snappy] and [deflate]. /**
* Enable deflate compression for this connection. A client cannot enable both [snappy] and [deflate].
*/
public bool $deflate = false, public bool $deflate = false,
/*
/**
* Configure the deflate compression level for this connection. * Configure the deflate compression level for this connection.
* *
* Valid range: `1 <= deflate_level <= configured_max` * Valid range: `1 <= deflate_level <= configured_max`
@@ -43,42 +52,54 @@ final class ClientConfig implements JsonSerializable
*/ */
public int $deflateLevel = 6, public int $deflateLevel = 6,
/* /**
* Milliseconds between heartbeats. * Milliseconds between heartbeats.
* *
* Valid range: `1000 <= heartbeat_interval <= configured_max` (`-1` disables heartbeats) * Valid range: `1000 <= heartbeat_interval <= configured_max` (`-1` disables heartbeats)
*/ */
public int $heartbeatInterval = 30000, public int $heartbeatInterval = 30000,
// The hostname where the client is deployed /**
* The hostname where the client is deployed.
*/
public string $hostname = '', public string $hostname = '',
// Configure the server-side message timeout in milliseconds for messages delivered to this client. /**
* Configure the server-side message timeout in milliseconds for messages delivered to this client.
*/
public int $msgTimeout = 60000, public int $msgTimeout = 60000,
/* /**
* The sample rate for incoming data to deliver a percentage of all messages received to this connection. * The sample rate for incoming data to deliver a percentage of all messages received to this connection.
* This only applies to subscribing connections. The valid range is between 0 and 99, where 0 means that all * This only applies to subscribing connections. The valid range is between 0 and 99, where 0 means that all
* data is sent (this is the default). 1 means that 1% of the data is sent. * data is sent (this is the default). 1 means that 1% of the data is sent.
*/ */
public int $sampleRate = 0, public int $sampleRate = 0,
/* /**
* Boolean used to indicate that the client supports feature negotiation. If the server is capable, * Boolean used to indicate that the client supports feature negotiation. If the server is capable,
* it will send back a JSON payload of supported features and metadata. * it will send back a JSON payload of supported features and metadata.
*/ */
public bool $featureNegotiation = true, public bool $featureNegotiation = true,
// Enable TLS for this connection /**
* Enable TLS for this connection.
*/
public bool $tls = false, public bool $tls = false,
// Enable snappy compression for this connection. A client cannot enable both [snappy] and [deflate]. /**
* Enable snappy compression for this connection. A client cannot enable both [snappy] and [deflate].
*/
public bool $snappy = false, public bool $snappy = false,
// The read timeout for connection sockets and for awaiting responses from nsq. /**
* The read timeout for connection sockets and for awaiting responses from nsq.
*/
public int $readTimeout = 5, public int $readTimeout = 5,
// A string identifying the agent for this client in the spirit of HTTP. /**
* A string identifying the agent for this client in the spirit of HTTP.
*/
public string $userAgent = '', public string $userAgent = '',
) { ) {
$this->featureNegotiation = true; // Always enabled $this->featureNegotiation = true; // Always enabled

View File

@@ -12,47 +12,72 @@ namespace Nsq\Config;
final class ConnectionConfig final class ConnectionConfig
{ {
public function __construct( public function __construct(
// Whether or not authorization is required by nsqd. /**
* Whether or not authorization is required by nsqd.
*/
public bool $authRequired, public bool $authRequired,
// Whether deflate compression is enabled for this connection or not. /**
* Whether deflate compression is enabled for this connection or not.
*/
public bool $deflate, public bool $deflate,
// The deflate level. This value can be ignored if [deflate] is `false`.
/**
* The deflate level. This value can be ignored if [deflate] is `false`.
*/
public int $deflateLevel, public int $deflateLevel,
// The maximum deflate level supported by the server. /**
* The maximum deflate level supported by the server.
*/
public int $maxDeflateLevel, public int $maxDeflateLevel,
// The maximum value for message timeout. /**
* The maximum value for message timeout.
*/
public int $maxMsgTimeout, public int $maxMsgTimeout,
/*
/**
* Each nsqd is configurable with a max-rdy-count. If the consumer sends a RDY count that is outside * Each nsqd is configurable with a max-rdy-count. If the consumer sends a RDY count that is outside
* of the acceptable range its connection will be forcefully closed. * of the acceptable range its connection will be forcefully closed.
*/ */
public int $maxRdyCount, public int $maxRdyCount,
// The effective message timeout. /**
* The effective message timeout.
*/
public int $msgTimeout, public int $msgTimeout,
// The size in bytes of the buffer nsqd will use when writing to this client. /**
* The size in bytes of the buffer nsqd will use when writing to this client.
*/
public int $outputBufferSize, public int $outputBufferSize,
// The timeout after which any data that nsqd has buffered will be flushed to this client.
/**
* The timeout after which any data that nsqd has buffered will be flushed to this client.
*/
public int $outputBufferTimeout, public int $outputBufferTimeout,
/* /**
* The sample rate for incoming data to deliver a percentage of all messages received to this connection. * The sample rate for incoming data to deliver a percentage of all messages received to this connection.
* This only applies to subscribing connections. The valid range is between 0 and 99, where 0 means that all * This only applies to subscribing connections. The valid range is between 0 and 99, where 0 means that all
* data is sent (this is the default). 1 means that 1% of the data is sent. * data is sent (this is the default). 1 means that 1% of the data is sent.
*/ */
public int $sampleRate, public int $sampleRate,
// Whether snappy compression is enabled for this connection or not. /**
* Whether snappy compression is enabled for this connection or not.
*/
public bool $snappy, public bool $snappy,
// Whether TLS is enabled for this connection or not. /**
* Whether TLS is enabled for this connection or not.
*/
public bool $tls, public bool $tls,
// The nsqd version. /**
* The nsqd version.
*/
public string $version, public string $version,
) { ) {
} }