\D3strukt0r\Votifier\Client\Server

ServerInterface

interface D3strukt0r\Votifier\Client\Server\ServerInterface

The interface ServerInterface is used to define a PluginType on the server.

public getHost() → string|null

Gets the host.

Returns:string|null — Returns the host
public setHost($host)

Sets the host.

Parameters:
  • $host (string) – The host
Returns:

$this — Returns the class itself, for doing multiple things at once

public getPort() → int

Gets the port.

Returns:int — Returns the port
public setPort($port)

Sets the port.

Parameters:
  • $port (int) – The port
Returns:

$this — Returns the class itself, for doing multiple things at once

public getPublicKey() → string|null

Gets the public key.

Returns:string|null — Returns the public key
public setPublicKey($publicKey)

Sets the public key.

Parameters:
  • $publicKey (string) – The public key
Returns:

$this — Returns the class itself, for doing multiple things at once

public verifyConnection()

Checks if the server actually belongs to Votifier.

Throws:

InvalidArgumentException

If one required parameter wasn’t set

Throws:

D3strukt0r\Votifier\Client\Exception\Socket\NoConnectionException

If connection couldn’t be established

Throws:

D3strukt0r\Votifier\Client\Exception\Socket\PackageNotReceivedException

If there was an error receiving the package

Throws:

D3strukt0r\Votifier\Client\Exception\NotVotifierException

If the server we are connected to is not a valid Votifier server

public sendVote(...$votes)

Sends the vote packages to the server.

Parameters:
  • $votes (D3strukt0r\Votifier\Client\Vote\VoteInterface) – The vote packages
Throws:

InvalidArgumentException

If one required parameter wasn’t set

Throws:

D3strukt0r\Votifier\Client\Exception\Socket\NoConnectionException

If connection couldn’t be established

Throws:

D3strukt0r\Votifier\Client\Exception\Socket\PackageNotReceivedException

If there was an error receiving the package

Throws:

D3strukt0r\Votifier\Client\Exception\Socket\PackageNotSentException

If there was an error sending the package

Throws:

D3strukt0r\Votifier\Client\Exception\NotVotifierException

If the server we are connected to is not a valid Votifier server