Protocol
Less than 1 minute
Protocol
- Full name:
\Hazaar\Warlock\Protocol
Properties
typeCodes
public static array<int,string> $typeCodes
- This property is static.
sid
private string $sid
lastError
private string $lastError
encoded
private bool $encoded
Methods
__construct
public __construct(string $sid, bool $encoded = true): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$sid | string | |
$encoded | bool |
getLastError
public getLastError(): string
encoded
public encoded(): bool
check
Checks that a protocol message type is valid and returns it's numeric value.
public check(int|string $type): false|int
Parameters:
Parameter | Type | Description |
---|---|---|
$type | int|string | If $type is a string, it is checked and if valid then it's numeric value is returned. If $type is an integer it will be returned back if valid. If either is not valid then false is returned. |
Return Value:
The integer value of the message type. False if the type is not valid.
getType
public getType(string $name): false|int
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string |
getTypeName
public getTypeName(mixed $type): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$type | mixed |
encode
public encode(string $type, mixed $payload = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$type | string | |
$payload | mixed |
decode
public decode(string& $packet, mixed& $payload = null, ?int& $time = null): false|string
Parameters:
Parameter | Type | Description |
---|---|---|
$packet | string | |
$payload | mixed | |
$time | ?int |
error
private error(string $msg): false
Parameters:
Parameter | Type | Description |
---|---|---|
$msg | string |
Automatically generated on 2024-11-14