將所有Exception的Namespace全部統一移到UElearning\Exception & 改良架構
This commit is contained in:
parent
ec0a1e535c
commit
a13399350d
1
.gitignore
vendored
1
.gitignore
vendored
@ -29,3 +29,4 @@ composer.lock
|
||||
|
||||
# Gem
|
||||
Gemfile.lock
|
||||
/nbproject/
|
@ -20,6 +20,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
||||
* require_once __DIR__.'/config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'Database/DBAdmin.php';
|
||||
* use UElearning\Database;
|
||||
* use UElearning\Exception;
|
||||
* $db = new Database\DBAdmin();
|
||||
*
|
||||
* 若要自行指定連結參數,請使用:
|
||||
@ -43,7 +44,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
||||
*
|
||||
* try {
|
||||
* $db = new Database\DBAdmin();
|
||||
* } catch (Database\Exception\DatabaseNoSupportException $e) {
|
||||
* } catch (Database\DatabaseNoSupportException $e) {
|
||||
* echo 'No Support in ', $e->getType();
|
||||
* } catch (Exception $e) {
|
||||
* echo 'Caught other exception: ', $e->getMessage();
|
||||
|
0
htdocs/lib/Database/DBTarget.php
Normal file
0
htdocs/lib/Database/DBTarget.php
Normal file
@ -7,6 +7,8 @@
|
||||
|
||||
namespace UElearning\Database;
|
||||
|
||||
use UElearning\Exception;
|
||||
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/Database.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
||||
|
||||
@ -44,7 +46,7 @@ class DBUser extends Database {
|
||||
*
|
||||
*
|
||||
* // 若設定的DBMS不被支援 則丟出例外
|
||||
* catch (Database\Exception\DatabaseNoSupportException $e) {
|
||||
* catch (Exception\DatabaseNoSupportException $e) {
|
||||
* echo 'No Support in ', $e->getType();
|
||||
* } catch (Exception $e) {
|
||||
* echo 'Caught other exception: ', $e->getMessage();
|
||||
@ -125,6 +127,7 @@ class DBUser extends Database {
|
||||
* require_once __DIR__.'/../config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
* use UElearning\Database;
|
||||
* use UElearning\Exception;
|
||||
*
|
||||
* try {
|
||||
* $db = new Database\DBUser();
|
||||
@ -135,7 +138,7 @@ class DBUser extends Database {
|
||||
*
|
||||
*
|
||||
* // 若設定的DBMS不被支援 則丟出例外
|
||||
* catch (Database\Exception\DatabaseNoSupportException $e) {
|
||||
* catch (Exception\DatabaseNoSupportException $e) {
|
||||
* echo 'No Support in ', $e->getType();
|
||||
* } catch (Exception $e) {
|
||||
* echo 'Caught other exception: ', $e->getMessage();
|
||||
|
@ -10,7 +10,7 @@ namespace UElearning\Database;
|
||||
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/MySQLDB.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/Exception.php';
|
||||
use UElearning\Database\Exception;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 資料庫操作抽象類別
|
||||
@ -109,7 +109,7 @@ abstract class Database {
|
||||
* 'prefix' => 'chu_' )
|
||||
* 若不填寫將會直接使用設定在`config.php`的常數
|
||||
*
|
||||
* @throws UElearning\Database\Exception\DatabaseNoSupportException
|
||||
* @throws UElearning\Exception\DatabaseNoSupportException
|
||||
* @author Yuan Chiu <chyuaner@gmail.com>
|
||||
* @since 2.0.0
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 資料庫相關的例外檔案
|
||||
*/
|
||||
|
||||
namespace UElearning\Database\Exception;
|
||||
namespace UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 沒有支援的資料庫系統例外
|
||||
|
@ -1,8 +0,0 @@
|
||||
Database
|
||||
===
|
||||
|
||||
## 全域變數
|
||||
* DB_NAME
|
||||
* DB_HOST
|
||||
* DB_USER
|
||||
* DB_PASS
|
0
htdocs/lib/Target/Exception.php
Normal file
0
htdocs/lib/Target/Exception.php
Normal file
0
htdocs/lib/Target/Target.php
Normal file
0
htdocs/lib/Target/Target.php
Normal file
@ -9,6 +9,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
use UElearning\Database;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 班級群組類別
|
||||
@ -27,7 +28,7 @@ use UElearning\Database;
|
||||
* $group->setName('測試用');
|
||||
* echo $group->getName();
|
||||
* }
|
||||
* catch (User\Exception\ClassNoFoundException $e) {
|
||||
* catch (Exception\ClassNoFoundException $e) {
|
||||
* echo 'No Found class: '. $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
@ -57,7 +58,7 @@ class ClassGroup {
|
||||
/**
|
||||
* 從資料庫取得此群組查詢
|
||||
*
|
||||
* @throw UElearning\User\Exception\ClassNoFoundException
|
||||
* @throw UElearning\Exception\ClassNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
protected function getQuery(){
|
||||
|
@ -6,9 +6,9 @@
|
||||
namespace UElearning\User;
|
||||
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
use UElearning\Database;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 管理班級群組的操作
|
||||
@ -35,7 +35,7 @@ class ClassGroupAdmin {
|
||||
* echo '你剛建立:'.$newId;
|
||||
* }
|
||||
* // 若已有重複班級ID
|
||||
* catch (User\Exception\ClassIdExistException $e) {
|
||||
* catch (Exception\ClassIdExistException $e) {
|
||||
* echo 'Is exist class: ', $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
@ -44,7 +44,7 @@ class ClassGroupAdmin {
|
||||
* 'name' => '學生',
|
||||
* 'memo' => null )
|
||||
* @return int 剛剛新增進去的ID
|
||||
* @throw UElearning\User\Exception\ClassIdExistException
|
||||
* @throw UElearning\Exception\ClassIdExistException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function create($classGroupArray) {
|
||||
@ -116,12 +116,12 @@ class ClassGroupAdmin {
|
||||
* $groupAdmin->remove(2);
|
||||
*
|
||||
* }
|
||||
* catch (User\Exception\ClassNoFoundException $e) {
|
||||
* catch (Exception\ClassNoFoundException $e) {
|
||||
* echo 'No Found class: ', $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
* @param int $class_id 班級ID
|
||||
* @throw UElearning\User\Exception\ClassNoFoundException
|
||||
* @throw UElearning\Exception\ClassNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function remove($class_id) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* 使用者帳號群組相關例外類別檔案
|
||||
*/
|
||||
|
||||
namespace UElearning\User\Exception;
|
||||
namespace UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 使用者帳號例外
|
||||
|
@ -1,11 +0,0 @@
|
||||
User Package
|
||||
===
|
||||
|
||||
## UserControl.php
|
||||
登入使用者帳號所用的
|
||||
|
||||
## User.php
|
||||
|
||||
|
||||
## UserAdmin.php
|
||||
管理使用者帳號、管理群組
|
@ -10,9 +10,9 @@ require_once UELEARNING_LIB_ROOT.'/User/UserGroupAdmin.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/UserGroup.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/ClassGroupAdmin.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/ClassGroup.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Util/Password.php';
|
||||
use UElearning\Exception;
|
||||
use UElearning\Database;
|
||||
use UElearning\Util;
|
||||
|
||||
@ -26,6 +26,7 @@ use UElearning\Util;
|
||||
* require_once __DIR__.'/../config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'/User/User.php';
|
||||
* use UElearning\User;
|
||||
* use UElearning\Exception;
|
||||
*
|
||||
* try {
|
||||
* $user = new User\User('yuan');
|
||||
@ -35,7 +36,7 @@ use UElearning\Util;
|
||||
*
|
||||
* echo 'NickName: '.$user->getNickName();
|
||||
* }
|
||||
* catch (User\Exception\UserNoFoundException $e) {
|
||||
* catch (Exception\UserNoFoundException $e) {
|
||||
* echo 'No Found user: '. $e->getUserId();
|
||||
* }
|
||||
*
|
||||
@ -64,7 +65,7 @@ class User {
|
||||
/**
|
||||
* 從資料庫取得此帳號查詢
|
||||
*
|
||||
* @throw UElearning\User\Exception\UserNoFoundException
|
||||
* @throw UElearning\Exception\UserNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
protected function getQuery(){
|
||||
@ -185,6 +186,7 @@ class User {
|
||||
* 取得所在群組顯示名稱
|
||||
*
|
||||
* @return string 群組名稱
|
||||
* @throw UElearning\Exception\GroupNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getGroupName(){
|
||||
@ -212,16 +214,17 @@ class User {
|
||||
* try {
|
||||
* $user->setGroup('student');
|
||||
* }
|
||||
* catch (User\Exception\GroupNoFoundException $e) {
|
||||
* catch (Exception\GroupNoFoundException $e) {
|
||||
* echo 'No Group to set: '. $e->getGroupId();
|
||||
* }
|
||||
* echo $user->getGroup();
|
||||
* }
|
||||
* catch (User\Exception\UserNoFoundException $e) {
|
||||
* catch (Exception\UserNoFoundException $e) {
|
||||
* echo 'No Found user: '. $e->getUserId();
|
||||
* }
|
||||
*
|
||||
* @param string $toGroup 群組ID
|
||||
* @throw UElearning\Exception\GroupNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function setGroup($toGroup){
|
||||
@ -252,6 +255,7 @@ class User {
|
||||
* 取得所在班級名稱
|
||||
*
|
||||
* @return string 班級名稱
|
||||
* @throw UElearning\Exception\ClassNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getClassName(){
|
||||
@ -284,15 +288,16 @@ class User {
|
||||
* try {
|
||||
* $user->setClass(1);
|
||||
* }
|
||||
* catch (User\Exception\ClassNoFoundException $e) {
|
||||
* catch (Exception\ClassNoFoundException $e) {
|
||||
* echo 'No Class to set: '. $e->getGroupId();
|
||||
* }
|
||||
* }
|
||||
* catch (User\Exception\UserNoFoundException $e) {
|
||||
* catch (Exception\UserNoFoundException $e) {
|
||||
* echo 'No Found user: '. $e->getUserId();
|
||||
* }
|
||||
*
|
||||
* @param string $toClass 班級ID
|
||||
* @throw UElearning\Exception\ClassNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function setClass($toClass){
|
||||
@ -305,7 +310,7 @@ class User {
|
||||
$this->setUpdate('class_id', $toClass);
|
||||
}
|
||||
else {
|
||||
throw new Exception\ClassNoFoundException($toGroup);
|
||||
throw new Exception\ClassNoFoundException($toClass);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -9,6 +9,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Util/Password.php';
|
||||
use UElearning\Exception;
|
||||
use UElearning\Database;
|
||||
use UElearning\Util;
|
||||
|
||||
@ -30,6 +31,7 @@ class UserAdmin {
|
||||
* require_once __DIR__.'/../config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'/User/UserAdmin.php';
|
||||
* use UElearning\User;
|
||||
* use UElearning\Exception;
|
||||
*
|
||||
* try {
|
||||
* $userAdmin = new User\UserAdmin();
|
||||
@ -44,7 +46,7 @@ class UserAdmin {
|
||||
*
|
||||
* }
|
||||
* // 若已有重複帳號名稱
|
||||
* catch (User\Exception\UserIdExistException $e) {
|
||||
* catch (Exception\UserIdExistException $e) {
|
||||
* echo 'Is exist user: ', $e->getUserId();
|
||||
* }
|
||||
*
|
||||
@ -62,7 +64,7 @@ class UserAdmin {
|
||||
* 'realname' => 'Eric Chiu', // (optional)
|
||||
* 'email' => 'eric@example.tw', // (optional)
|
||||
* 'memo' => '' ) // (optional)
|
||||
* @throw UElearning\User\Exception\UserIdExistException
|
||||
* @throw UElearning\Exception\UserIdExistException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function create($userInfoArray) {
|
||||
@ -74,7 +76,7 @@ class UserAdmin {
|
||||
if( !isset($userInfoArray['user_id']) ||
|
||||
!isset($userInfoArray['password']) ||
|
||||
!isset($userInfoArray['group_id']) ) {
|
||||
throw new UElearning\Exception\NoDataException();
|
||||
throw new Exception\NoDataException();
|
||||
}
|
||||
// 若此id已存在
|
||||
else if($this->isExist($userInfoArray['user_id'])) {
|
||||
@ -159,12 +161,12 @@ class UserAdmin {
|
||||
* $userAdmin = new User\UserAdmin();
|
||||
* $userAdmin->remove('eric');
|
||||
* }
|
||||
* catch (User\Exception\UserNoFoundException $e) {
|
||||
* catch (Exception\UserNoFoundException $e) {
|
||||
* echo 'No Found user: ', $e->getUserId();
|
||||
* }
|
||||
*
|
||||
* @param string $userName 帳號名稱
|
||||
* @throw UElearning\User\Exception\UserNoFoundException
|
||||
* @throw UElearning\Exception\UserNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function remove($userName) {
|
||||
|
@ -9,6 +9,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
use UElearning\Database;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 使用者群組類別
|
||||
@ -20,6 +21,7 @@ use UElearning\Database;
|
||||
* require_once __DIR__.'/../config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'/User/UserGroup.php'
|
||||
* use UElearning\User;
|
||||
* use UElearning\Exception;
|
||||
*
|
||||
* try {
|
||||
* $group = new User\UserGroup('testG');
|
||||
@ -27,7 +29,7 @@ use UElearning\Database;
|
||||
* $group->setName('測試用');
|
||||
* echo $group->getName();
|
||||
* }
|
||||
* catch (User\Exception\GroupNoFoundException $e) {
|
||||
* catch (Exception\GroupNoFoundException $e) {
|
||||
* echo 'No Found group: '. $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
@ -57,7 +59,7 @@ class UserGroup {
|
||||
/**
|
||||
* 從資料庫取得此群組查詢
|
||||
*
|
||||
* @throw UElearning\User\Exception\GroupNoFoundException
|
||||
* @throw UElearning\Exception\GroupNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
protected function getQuery(){
|
||||
@ -181,7 +183,7 @@ class UserGroup {
|
||||
*
|
||||
* @param string $permissionName 權限名稱
|
||||
* @return bool 是否擁有
|
||||
* @throw UElearning\User\Exception\PermissionNoFoundException
|
||||
* @throw UElearning\Exception\PermissionNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function havePermission($permissionName) {
|
||||
@ -199,7 +201,7 @@ class UserGroup {
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new PermissionNoFoundException('$permissionName');
|
||||
throw new Exception\PermissionNoFoundException('$permissionName');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -210,7 +212,7 @@ class UserGroup {
|
||||
* @param string $permissionName 權限名稱
|
||||
* @param string $setBool 是否給予
|
||||
* @return bool 是否擁有
|
||||
* @throw UElearning\User\Exception\PermissionNoFoundException
|
||||
* @throw UElearning\Exception\PermissionNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function setPermission($permissionName, $setBool) {
|
||||
@ -227,7 +229,7 @@ class UserGroup {
|
||||
$this->setUpdate('auth_clientAdmin', $setBool);
|
||||
break;
|
||||
default:
|
||||
throw new PermissionNoFoundException('$permissionName');
|
||||
throw new Exception\PermissionNoFoundException('$permissionName');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ require_once UELEARNING_LIB_ROOT.'/Database/DBUser.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/User/Exception.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Exception.php';
|
||||
use UElearning\Database;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 管理使用者權限群組的操作
|
||||
@ -37,7 +38,7 @@ class UserGroupAdmin {
|
||||
*
|
||||
* }
|
||||
* // 若已有重複群組ID
|
||||
* catch (User\Exception\GroupIdExistException $e) {
|
||||
* catch (Exception\GroupIdExistException $e) {
|
||||
* echo 'Is exist group: ', $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
@ -47,7 +48,7 @@ class UserGroupAdmin {
|
||||
* 'memo' => null, // (optional) 預設為null
|
||||
* 'auth_server_admin' => false, // (optional) 預設為false
|
||||
* 'auth_client_admin' => false ) // (optional) 預設為false
|
||||
* @throw UElearning\User\Exception\GroupIdExistException
|
||||
* @throw UElearning\Exception\GroupIdExistException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function create($groupArray) {
|
||||
@ -57,7 +58,7 @@ class UserGroupAdmin {
|
||||
|
||||
// 若必填項目無填寫
|
||||
if( !isset($groupArray['group_id']) ) {
|
||||
throw new UElearning\Exception\NoDataException();
|
||||
throw new Exception\NoDataException();
|
||||
}
|
||||
// 若此id已存在
|
||||
else if( $this->isExist($groupArray['group_id']) ) {
|
||||
@ -122,12 +123,12 @@ class UserGroupAdmin {
|
||||
* $groupAdmin->remove('test_student');
|
||||
*
|
||||
* }
|
||||
* catch (User\Exception\GroupNoFoundException $e) {
|
||||
* catch (Exception\GroupNoFoundException $e) {
|
||||
* echo 'No Found group: ', $e->getGroupId();
|
||||
* }
|
||||
*
|
||||
* @param string $group_id 群組ID
|
||||
* @throw UElearning\User\Exception\GroupNoFoundException
|
||||
* @throw UElearning\Exception\GroupNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function remove($group_id) {
|
||||
|
@ -11,6 +11,7 @@ require_once UELEARNING_LIB_ROOT.'/Util/Password.php';
|
||||
require_once UELEARNING_LIB_ROOT.'/Database/DBUserSession.php';
|
||||
use UElearning\Util;
|
||||
use UElearning\Database;
|
||||
use UElearning\Exception;
|
||||
|
||||
/**
|
||||
* 使用者登入階段管理
|
||||
@ -30,19 +31,20 @@ class UserSession {
|
||||
* require_once __DIR__.'/../config.php';
|
||||
* require_once UELEARNING_LIB_ROOT.'/User/UserSession.php';
|
||||
* use UElearning\User;
|
||||
* use UElearning\Exception;
|
||||
*
|
||||
* try {
|
||||
* $session = new User\UserSession();
|
||||
* $loginToken = $session->login('yuan', 'password', 'browser');
|
||||
* echo 'Token: '.$loginToken;
|
||||
* }
|
||||
* catch (User\Exception\UserNoFoundException $e) {
|
||||
* catch (Exception\UserNoFoundException $e) {
|
||||
* echo 'No Found user: '. $e->getUserId();
|
||||
* }
|
||||
* catch (User\Exception\UserPasswordErrException $e) {
|
||||
* catch (Exception\UserPasswordErrException $e) {
|
||||
* echo 'User Password wrong: '. $e->getUserId();
|
||||
* }
|
||||
* catch (User\Exception\UserNoActivatedException $e) {
|
||||
* catch (Exception\UserNoActivatedException $e) {
|
||||
* echo 'User No Activiated: '. $e->getUserId();
|
||||
* }
|
||||
*
|
||||
@ -50,9 +52,9 @@ class UserSession {
|
||||
* @param string $password 密碼
|
||||
* @param string $agent 用什麼裝置登入
|
||||
* @return string 登入session token
|
||||
* @throw UElearning\User\Exception\UserNoFoundException
|
||||
* @throw UElearning\User\Exception\UserPasswordErrException
|
||||
* @throw UElearning\User\Exception\UserNoActivatedException
|
||||
* @throw UElearning\Exception\UserNoFoundException
|
||||
* @throw UElearning\Exception\UserPasswordErrException
|
||||
* @throw UElearning\Exception\UserNoActivatedException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function login($userId, $password, $agent) {
|
||||
@ -90,7 +92,7 @@ class UserSession {
|
||||
}
|
||||
}
|
||||
// 沒有找到使用者
|
||||
catch (User\Exception\UserNoFoundException $e) {
|
||||
catch (Exception\UserNoFoundException $e) {
|
||||
echo 'No Found user: '. $e->getUserId();
|
||||
}
|
||||
}
|
||||
@ -106,12 +108,12 @@ class UserSession {
|
||||
* $session = new User\UserSession();
|
||||
* $session->logout('YdcfzqUuuRAR]4h6u4^Ew-qa4A-kvD5C');
|
||||
* }
|
||||
* catch (User\Exception\LoginTokenNoFoundException $e) {
|
||||
* catch (Exception\LoginTokenNoFoundException $e) {
|
||||
* echo 'No Login by token: '. $e->getToken();
|
||||
* }
|
||||
*
|
||||
* @param string $token 登入階段token
|
||||
* @throw \UElearning\User\Exception\LoginTokenNoFoundException
|
||||
* @throw \UElearning\Exception\LoginTokenNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function logout($token) {
|
||||
@ -132,7 +134,7 @@ class UserSession {
|
||||
* 將其他已登入的裝置登出
|
||||
* @param string $token 登入階段token
|
||||
* @return int 已登出數量
|
||||
* @throw \UElearning\User\Exception\LoginTokenNoFoundException
|
||||
* @throw \UElearning\Exception\LoginTokenNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function logoutOtherSession($token) {
|
||||
@ -182,13 +184,13 @@ class UserSession {
|
||||
* echo '暱稱: '.$user->getNickName(); // 取得暱稱
|
||||
* echo '本名: '.$user->getRealName(); // 取得本名
|
||||
* }
|
||||
* catch (User\Exception\LoginTokenNoFoundException $e) {
|
||||
* catch (Exception\LoginTokenNoFoundException $e) {
|
||||
* echo 'No Found Token: '. $e->getToken();
|
||||
* }
|
||||
*
|
||||
* @param string $token 登入階段token
|
||||
* @return User 使用者物件
|
||||
* @throw \UElearning\User\Exception\LoginTokenNoFoundException
|
||||
* @throw \UElearning\Exception\LoginTokenNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getUser($token) {
|
||||
@ -200,7 +202,7 @@ class UserSession {
|
||||
* 取得使用者ID
|
||||
* @param string $token 登入階段token
|
||||
* @return string 使用者ID
|
||||
* @throw \UElearning\User\Exception\LoginTokenNoFoundException
|
||||
* @throw \UElearning\Exception\LoginTokenNoFoundException
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public function getUserId($token) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user