Remove Config class
This commit is contained in:
@ -1,19 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Nsq;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @psalm-immutable
|
|
||||||
*/
|
|
||||||
final class Config
|
|
||||||
{
|
|
||||||
public string $address;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
string $address
|
|
||||||
) {
|
|
||||||
$this->address = $address;
|
|
||||||
}
|
|
||||||
}
|
|
@ -41,7 +41,7 @@ abstract class Connection
|
|||||||
|
|
||||||
private bool $closed = false;
|
private bool $closed = false;
|
||||||
|
|
||||||
private Config $config;
|
private string $address;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array{client_id: string, hostname: string, user_agent: string}
|
* @var array{client_id: string, hostname: string, user_agent: string}
|
||||||
@ -55,7 +55,7 @@ abstract class Connection
|
|||||||
string $hostname = null,
|
string $hostname = null,
|
||||||
string $userAgent = null
|
string $userAgent = null
|
||||||
) {
|
) {
|
||||||
$this->config = new Config($address);
|
$this->address = $address;
|
||||||
|
|
||||||
$this->features = [
|
$this->features = [
|
||||||
'client_id' => $clientId ?? '',
|
'client_id' => $clientId ?? '',
|
||||||
@ -68,7 +68,7 @@ abstract class Connection
|
|||||||
|
|
||||||
public function connect(): void
|
public function connect(): void
|
||||||
{
|
{
|
||||||
$this->socket = (new Factory())->createClient($this->config->address);
|
$this->socket = (new Factory())->createClient($this->address);
|
||||||
$this->send(' V2');
|
$this->send(' V2');
|
||||||
|
|
||||||
$body = json_encode($this->features, JSON_THROW_ON_ERROR | JSON_FORCE_OBJECT);
|
$body = json_encode($this->features, JSON_THROW_ON_ERROR | JSON_FORCE_OBJECT);
|
||||||
|
Reference in New Issue
Block a user