]>
jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blob - lib/ServerBanException.php
8 class ServerBanException
11 public Connection
$connection;
13 public function __construct(Connection
$conn)
15 $this->connection
= $conn;
19 * Add a ban exceptions.
22 * @return stdClass|array|bool
25 public function add(string $name, string $types, string $reason, string $set_by = NULL, string $duration = NULL): stdClass
|array|bool
29 'exception_types' => $types,
33 $query['set_by'] = $set_by;
36 $query['duration_string'] = $duration;
38 $response = $this->connection
->query('server_ban_exception.add', $query);
40 if (is_bool($response))
43 if (property_exists($response, 'tkl'))
44 return $response->tkl
;
49 * Delete a ban exceptions.
52 * @return stdClass|array|bool
55 public function delete(string $name): stdClass
|array|bool
57 $response = $this->connection
->query('server_ban_exception.del', [
61 if (is_bool($response))
64 if (property_exists($response, 'tkl'))
65 return $response->tkl
;
70 * Return a list of all exceptions.
72 * @return stdClass|array|bool
75 public function getAll(): stdClass
|array|bool
77 $response = $this->connection
->query('server_ban_exception.list', []);
79 if (!is_bool($response)) {
80 return $response->list;
83 throw new Exception('Invalid JSON Response from UnrealIRCd RPC.');
87 * Get a specific ban exceptions.
89 * @return stdClass|array|bool
92 public function get(string $name): stdClass
|array|bool
94 $response = $this->connection
->query('server_ban_exception.get', [
98 if (!is_bool($response)) {
99 return $response->tkl
;
102 return false; // didn't exist