]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blobdiff - lib/ServerBan.php
Don't use arrays in parameters but use explicit options everwhere.
[irc/unrealircd/unrealircd-rpc-php.git] / lib / ServerBan.php
index c1c9a2fda3bafd808d3e1e4cc194b6f3c1f81917..2a7eaabbc84e7ebdc35d96ba68972ba0f0941c80 100644 (file)
@@ -5,7 +5,7 @@ namespace UnrealIRCd;
 use Exception;
 use stdClass;
 
-class Ban implements Contracts\Ban
+class ServerBan implements Contracts\ServerBan
 {
 
     public Connection $connection;
@@ -19,33 +19,31 @@ class Ban implements Contracts\Ban
      * Add a ban.
      *
      * @param  string  $user
-     * @param  array  $params
      * @return stdClass
      * @throws Exception
      */
-    public function add(string $user, array $params): stdClass
+    public function add(string $name, string $type, string $duration, string $reason): stdClass
     {
         return $this->connection->query('server_ban.add', [
-            'name' => $user,
-            'type' => $params['type'],
-            'reason' => $params['reason'],
-            'duration_string' => $params['length'] ?? '1d',
+            'name' => $name,
+            'type' => $type,
+            'reason' => $reason,
+            'duration_string' => $duration ?? '1d',
         ]);
     }
 
     /**
      * Delete a ban.
      *
-     * @param  string  $user
-     * @param  array  $params
+     * @param  string  $name
      * @return stdClass
      * @throws Exception
      */
-    public function delete(string $user, array $params): stdClass
+    public function delete(string $name, string $type): stdClass
     {
         return $this->connection->query('server_ban.del', [
-            'name' => $user,
-            'type' => $params['type'],
+            'name' => $name,
+            'type' => $type,
         ]);
     }