]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/Ban.php
8 class Ban
implements Contracts\Ban
11 public Connection
$connection;
13 public function __construct(string $uri, string $api_login, array $options)
15 $this->connection
= new Connection($uri, $api_login, $options);
22 * @param array $params
26 public function add(string $user, array $params): stdClass
28 $response = $this->connection
->query('server_ban.add', [
30 'type' => $params['type'],
31 'reason' => $params['reason'],
32 'length' => $params['length'] ?? '1d',
42 * @param array $params
46 public function delete(string $user, array $params): stdClass
48 $response = $this->connection
->query('server_ban.del', [
50 'type' => $params['type'],
57 * Return a list of all bans.
62 public function get(): stdClass
64 $response = $this->connection
->query('server_ban.list');
66 if (!is_bool($response)) {
70 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
74 * Show a specific ban.
76 * @param array $params
80 public function show(array $params): stdClass
82 $response = $this->connection
->query('server_ban.get', [
83 'name' => $params['name'],
84 'type' => $params['type']
87 if (!is_bool($response)) {
91 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');