Nexus API Reference

Port
in package
implements Stringable

Read onlyYes
FinalYes
Tags
psalm-api

Immutable TCP/UDP port number value object. Valid range is 0–65535. Port 0 is allowed and documented as "OS-assigned / ephemeral" — used for bind endpoints where the OS picks the port.

example

$port = Port::of(7355); echo $port; // '7355' $port->value; // 7355 (int) Port::of(0); // valid — OS-assigned ephemeral port

Table of Contents

Interfaces

Stringable

Properties

$value  : int

Methods

__toString()  : string
equals()  : bool
of()  : self
Create a Port from an integer in the valid range 0–65535.

Properties

$value

public int $value

Methods

__toString()

public __toString() : string
Attributes
#[Override]
Return values
string

equals()

public equals(self $other) : bool
Parameters
$other : self
Return values
bool

of()

Create a Port from an integer in the valid range 0–65535.

public static of(int $value) : self
Parameters
$value : int
Tags
throws
InvalidArgumentException

when the value is outside the valid range.

Return values
self
On this page

Search results