Skip to content

Commit 10e3b6c

Browse files
committed
Removed close method from abstracts credentials settings from bootstrapper
1 parent 91a1f94 commit 10e3b6c

File tree

4 files changed

+3
-89
lines changed

4 files changed

+3
-89
lines changed

src/AbstractSocket.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,4 @@ public function __construct(SocketFacade $facade)
2626
* @return string|bool
2727
*/
2828
abstract public function send(string $message);
29-
30-
/**
31-
* Close created socket connection
32-
* @throws \Qonsillium\Exceptions\FailedCloseSocket
33-
* @return void
34-
*/
35-
abstract public function close();
36-
37-
/**
38-
* Destruct AbstractSocket class and
39-
* close socket connection
40-
* @return void
41-
*/
42-
public function __destruct()
43-
{
44-
$this->close();
45-
}
4629
}

src/Bootstrapper.php

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -74,58 +74,9 @@ public function setCredentials()
7474
$socketTypeFactory = $this->getSocketTypeFactory();
7575
$socketType = $socketTypeFactory->getSocket($this->settings['settings']['socket_type']);
7676

77-
78-
$credentials->setCredential(
79-
'domain',
80-
$this->getConstValue('domain', $socketType->get('domain'))
81-
);
82-
83-
$credentials->setCredential(
84-
'type',
85-
$this->getConstValue('type', $socketType->get('type'))
86-
);
87-
88-
$credentials->setCredential(
89-
'protocol',
90-
$this->getConstValue('protocol', $socketType->get('protocol'))
91-
);
92-
93-
$credentials->setCredential(
94-
'backlog',
95-
$socketType->get('backlog')
96-
);
97-
98-
$credentials->setCredential(
99-
'read_length',
100-
$socketType->get('read_length')
101-
);
102-
103-
$credentials->setCredential(
104-
'read_flag',
105-
$this->getConstValue('read_flags', $socketType->get('read_flag'))
106-
);
107-
108-
// We have two types of sockets it's TCP or Unix, so also
109-
// we have two handlers which contain this settings
110-
// TCP handler contains host and port and Unix handler
111-
// socket file
112-
if ($socketType->validate('socket_file')) {
113-
$credentials->setCredential(
114-
'socket_file',
115-
$socketType->get('socket_file')
116-
);
117-
118-
return $credentials;
119-
}
120-
12177
$credentials->setCredential(
12278
'host',
123-
$socketType->get('host')
124-
);
125-
126-
$credentials->setCredential(
127-
'port',
128-
$socketType->get('port')
79+
"{$socketType->get('socket_type')}://{$socketType->get('address')}:{$socketType->get('port')}"
12980
);
13081

13182
return $credentials;

src/ClientSocket.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ public function send(string $message)
1818
return false;
1919
}
2020

21-
return $sendedMessage->getMessage();
22-
}
23-
24-
/**
25-
* Close socket created socket connection
26-
* @throws \Qonsillium\Exceptions\FailedCloseSocket
27-
* @return void
28-
*/
29-
public function close()
30-
{
31-
return $this->facade->closeSocket();
21+
return $sendedMessage;
3222
}
3323
}

src/ServerSocket.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,6 @@ public function send(string $message)
1818
return false;
1919
}
2020

21-
return $sendedMessage->getMessage();
22-
}
23-
24-
/**
25-
* Close socket created socket connection
26-
* @throws \Qonsillium\Exceptions\FailedCloseSocket
27-
* @return void
28-
*/
29-
public function close()
30-
{
31-
return $this->facade->closeSocket();
21+
return $sendedMessage;
3222
}
3323
}

0 commit comments

Comments
 (0)