From 930314f1acee600b52fd8abe40aa5de1b36cd171 Mon Sep 17 00:00:00 2001 From: Konstantin Grachev Date: Sat, 30 Jan 2021 18:26:31 +0300 Subject: [PATCH] Convert comments to phpdoc --- src/Config/ClientConfig.php | 51 +++++++++++++++++++++++---------- src/Config/ConnectionConfig.php | 51 ++++++++++++++++++++++++--------- 2 files changed, 74 insertions(+), 28 deletions(-) diff --git a/src/Config/ClientConfig.php b/src/Config/ClientConfig.php index a08c18c..8117233 100644 --- a/src/Config/ClientConfig.php +++ b/src/Config/ClientConfig.php @@ -18,23 +18,32 @@ use function gethostname; */ final class ClientConfig implements JsonSerializable { - /** @psalm-suppress ImpureFunctionCall */ + /** + * @psalm-suppress ImpureFunctionCall + */ public function __construct( - /* + /** * The secret used for authorization, if the server requires it. This value will be ignored if the server * does not require authorization. */ public ?string $authSecret = null, - // The timeout for establishing a connection in seconds. + /** + * The timeout for establishing a connection in seconds. + */ 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 = '', - // 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, - /* + + /** * Configure the deflate compression level for this connection. * * Valid range: `1 <= deflate_level <= configured_max` @@ -43,42 +52,54 @@ final class ClientConfig implements JsonSerializable */ public int $deflateLevel = 6, - /* + /** * Milliseconds between heartbeats. * * Valid range: `1000 <= heartbeat_interval <= configured_max` (`-1` disables heartbeats) */ public int $heartbeatInterval = 30000, - // The hostname where the client is deployed + /** + * The hostname where the client is deployed. + */ 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, - /* + /** * 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 * data is sent (this is the default). 1 means that 1% of the data is sent. */ public int $sampleRate = 0, - /* + /** * 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. */ public bool $featureNegotiation = true, - // Enable TLS for this connection + /** + * Enable TLS for this connection. + */ 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, - // 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, - // 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 = '', ) { $this->featureNegotiation = true; // Always enabled diff --git a/src/Config/ConnectionConfig.php b/src/Config/ConnectionConfig.php index 7145b27..b489fd5 100644 --- a/src/Config/ConnectionConfig.php +++ b/src/Config/ConnectionConfig.php @@ -12,47 +12,72 @@ namespace Nsq\Config; final class ConnectionConfig { public function __construct( - // Whether or not authorization is required by nsqd. + /** + * Whether or not authorization is required by nsqd. + */ 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, - // 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, - // The maximum deflate level supported by the server. + /** + * The maximum deflate level supported by the server. + */ public int $maxDeflateLevel, - // The maximum value for message timeout. + /** + * The maximum value for message timeout. + */ public int $maxMsgTimeout, - /* + + /** * 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. */ public int $maxRdyCount, - // The effective message timeout. + /** + * The effective message timeout. + */ 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, - // 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, - /* + /** * 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 * data is sent (this is the default). 1 means that 1% of the data is sent. */ 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, - // Whether TLS is enabled for this connection or not. + /** + * Whether TLS is enabled for this connection or not. + */ public bool $tls, - // The nsqd version. + /** + * The nsqd version. + */ public string $version, ) { }