/packages/Chat/Chat/Objects/ChatUser.class.php

https://bitbucket.org/alexamiryan/stingle · PHP · 17 lines · 15 code · 2 blank · 0 comment · 1 complexity · 3f89c10fb2f6f06c46e3e356045f63a3 MD5 · raw file

  1. <?php
  2. class ChatUser
  3. {
  4. public $userId;
  5. public function __construct($userId){
  6. if(empty($userId) or !is_numeric($userId)){
  7. throw new InvalidArgumentException("\$userId has to be non zero integer");
  8. }
  9. $this->userId = $userId;
  10. }
  11. public static function getObject($userId){
  12. $chatUserClassName = ConfigManager::getConfig("Chat", "Chat")->AuxConfig->chatUserClassName;
  13. return new $chatUserClassName($userId);
  14. }
  15. }