Service.php 633 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace Easemob\Agora;
  3. /**
  4. * @ignore
  5. */
  6. class Service
  7. {
  8. public $type;
  9. public $privileges;
  10. public function __construct($serviceType)
  11. {
  12. $this->type = $serviceType;
  13. }
  14. public function addPrivilege($privilege, $expire)
  15. {
  16. $this->privileges[$privilege] = $expire;
  17. }
  18. public function getServiceType()
  19. {
  20. return $this->type;
  21. }
  22. public function pack()
  23. {
  24. return Util::packUint16($this->type) . Util::packMapUint32($this->privileges);
  25. }
  26. public function unpack(&$data)
  27. {
  28. $this->privileges = Util::unpackMapUint32($data);
  29. }
  30. }