]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/ServerBan.php
11 public Connection
$connection;
13 public function __construct(Connection
$conn)
15 $this->connection
= $conn;
22 * @return stdClass|array|bool
25 public function add(string $name, string $type, string $duration, string $reason): stdClass
|array|bool
27 return $this->connection
->query('server_ban.add', [
31 'duration_string' => $duration ?? '1d',
39 * @return stdClass|array|bool
42 public function delete(string $name, string $type): stdClass
|array|bool
44 return $this->connection
->query('server_ban.del', [
51 * Return a list of all bans.
53 * @return stdClass|array|bool
56 public function getAll(): stdClass
|array|bool
58 $response = $this->connection
->query('server_ban.list');
60 if (!is_bool($response)) {
61 return $response->list;
64 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
70 * @return stdClass|array|bool
73 public function get(string $name, string $type): stdClass
|array|bool
75 $response = $this->connection
->query('server_ban.get', [
80 if (!is_bool($response)) {
84 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');