-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathConnectedRelayInterface.php
More file actions
38 lines (31 loc) · 1.04 KB
/
ConnectedRelayInterface.php
File metadata and controls
38 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
declare(strict_types=1);
namespace Spiral\Goridge;
use Spiral\Goridge\Exception\RelayException;
/**
* This interface describes a Relay that explictily establishes a connection.
* That connection can also be re-established on the fly (in comparison to StreamRelay, which relies on the existence of the streams).
* The object is also clonable, i.e. supports cloning without data errors due to shared state.
*/
interface ConnectedRelayInterface extends RelayInterface
{
/**
* Returns true if the underlying connection is already established
*/
public function isConnected(): bool;
/**
* Establishes the underlying connection and returns true on success, false on failure, or throws an exception in case of an error.
*
* @throws RelayException
*/
public function connect(): bool;
/**
* Closes the underlying connection.
*/
public function close(): void;
/**
* Enforce implementation of __clone magic method
* @psalm-return void
*/
public function __clone();
}