| 1 | <?php |
||
| 15 | class Endpoint |
||
| 16 | { |
||
| 17 | |||
| 18 | /** |
||
| 19 | * The address for the socket |
||
| 20 | * |
||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private $address; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The port for the socket |
||
| 27 | * |
||
| 28 | * @var int |
||
| 29 | */ |
||
| 30 | private $port; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Create a new endpoint |
||
| 34 | * |
||
| 35 | * @param string $address |
||
| 36 | * The address for the socket |
||
| 37 | * @param int $port |
||
| 38 | * The port for the socket |
||
| 39 | */ |
||
| 40 | 38 | public function __construct($address, $port) |
|
| 45 | |||
| 46 | /** |
||
| 47 | * Retrieve the address of the endpoint |
||
| 48 | * |
||
| 49 | * @return string The address |
||
| 50 | */ |
||
| 51 | 33 | public function getAddress(): string |
|
| 55 | |||
| 56 | /** |
||
| 57 | * Retrieve the port of the endpoint |
||
| 58 | * |
||
| 59 | * @return int The port |
||
| 60 | */ |
||
| 61 | 34 | public function getPort(): int |
|
| 65 | |||
| 66 | /** |
||
| 67 | * Retrieve the endpoint as string |
||
| 68 | * |
||
| 69 | * @return string |
||
| 70 | */ |
||
| 71 | public function __toString(): string |
||
| 75 | } |
||
| 76 |