\D3strukt0r\VotifierClient\ServerType

ClassicVotifier

class D3strukt0r\VotifierClient\ServerType\ClassicVotifier

The Class to access a server which uses the classic “Votifier” plugin.

private property $host

string — The domain or ip to connect to Votifier

private property $port

int — The port which votifier uses on the server

private property $publicKey

string — The public.key which is generated by the plugin.

public __construct($host, $port, $publicKey)

Creates the ClassicVotifier object.

Parameters:
  • $host (string) – (Required) The domain or ip to connect to Votifier
  • $port (int|null) – (Required) The port which votifier uses on the server
  • $publicKey (string) – (Required) The public.key which is generated by the plugin
public getHost() → string

Returns the host.

Returns:string — Returns the host
public getPort() → int

Returns the port.

Returns:int — Returns the port
public getPublicKey() → string

Returns the public key.

Returns:string — Returns the public key
public verifyConnection($header) → bool

Verifies that the connection is correct.

Parameters:
  • $header (bool|string) – (Required) The header that the plugin usually sends
Returns:

bool — Returns true if connections is available, otherwise false

public preparePackage($vote) → string

Create encrypted package for default Votifier.

Parameters:
  • $vote (\D3strukt0r\VotifierClient\VoteType\VoteInterface) – (Required) The vote package with all the information
Returns:

string — Returns the string to be sent to the server

public send($connection, $vote)

Sends the vote package to the server.

Parameters:
  • $connection (\D3strukt0r\VotifierClient\ServerConnection) – (Required) The connection type to the plugin
  • $vote (\D3strukt0r\VotifierClient\VoteType\VoteInterface) – (Required) The vote type package
Throws:

\Exception