Esempio n. 1
0
 public function testGetPresences()
 {
     $this->assertEquals(['online', 'idle', 'offline'], User::getPresences());
 }
Esempio n. 2
0
 /**
  * Set user status.
  *
  * @param int $id - userId
  * @param string $presence - status
  * @param string $sessionId - session id
  *
  * @throws InvalidArgumentException
  * @throws Exception
  */
 public function setPresence($id, $presence, $sessionId)
 {
     if ($this->isEmptyId($id)) {
         throw new InvalidArgumentException();
     }
     if (!in_array($presence, User::getPresences())) {
         throw new InvalidArgumentException();
     }
     if (!$sessionId) {
         throw new InvalidArgumentException();
     }
     $params = ['presence' => $presence, 'session' => $sessionId];
     $this->call('users/' . $id . '/setpresence', $params, 'post');
 }