public function __construct($token = null) { $this->service = BOL_UserService::getInstance(); $this->userId = 0; $this->token = $token; if ($token !== null) { $this->userId = (int) $this->service->findUserIdByAuthToken($token); } }