]> jfr.im git - irc/unrealircd/unrealircd-rpc-php.git/blobdiff - lib/Channel.php
Merge pull request #3 from unrealircd/wip
[irc/unrealircd/unrealircd-rpc-php.git] / lib / Channel.php
index c969467306ba2fb7e19ad3e24a083e4b2c651bb3..a3e0b4880070a9411f2ddd14de57dc9e7782b2fa 100644 (file)
@@ -3,6 +3,7 @@
 namespace UnrealIRCd;
 
 use Exception;
+use stdClass;
 
 class Channel implements Contracts\User
 {
@@ -17,17 +18,12 @@ class Channel implements Contracts\User
     /**
      * Return a list of channels users.
      *
+     * @return stdClass
      * @throws Exception
      */
-    public function get(): array
+    public function get(): stdClass
     {
-        $id = random_int(100, 1000);
-
-        $response = $this->connection->query($id, 'channel.list');
-
-        if($id !== $response->id) {
-            throw new Exception('Invalid ID. This is not the expected reply.');
-        }
+        $response = $this->connection->query('channel.list');
 
         if(!is_bool($response)) {
             return $response;
@@ -40,18 +36,12 @@ class Channel implements Contracts\User
      * Return a channel object
      *
      * @param  array  $params
-     * @return object|bool
+     * @return stdClass
      * @throws Exception
      */
-    public function show(array $params): object|bool
+    public function show(array $params): stdClass
     {
-        $id = random_int(100, 1000);
-
-        $response = $this->connection->query($id, 'channel.get', ['channel' => $params['channel']]);
-
-        if($id !== $response->id) {
-            throw new Exception('Invalid ID. This is not the expected reply.');
-        }
+        $response = $this->connection->query('channel.get', ['channel' => $params['channel']]);
 
         if (!is_bool($response)) {
             return $response;