00001 <?php 00024 class ShipSimuGuest extends ShipSimuBaseUser implements ManageableGuest { 00025 // Exceptions 00026 const EXCEPTION_USERNAME_NOT_FOUND = 0x170; 00027 const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x171; 00028 const EXCEPTION_USER_PASS_MISMATCH = 0x172; 00029 00036 protected function __construct ($className = __CLASS__) { 00037 // Call parent constructor 00038 parent::__construct($className); 00039 } 00040 00050 public final static function createGuestByUsername ($userName) { 00051 // Get a new instance 00052 $userInstance = new ShipSimuGuest(); 00053 00054 // Set the username 00055 $userInstance->setUserName($userName); 00056 00057 // Check if username exists 00058 if ($userInstance->ifUsernameExists() === false) { 00059 // Throw an exception here 00060 throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND); 00061 } // END - if 00062 00063 // Return the instance 00064 return $userInstance; 00065 } 00066 00074 public final static function createGuestByEmail ($email) { 00075 // Get a new instance 00076 $userInstance = new ShipSimuGuest(); 00077 00078 // Set the username 00079 $userInstance->setEmail($email); 00080 00081 // Return the instance 00082 return $userInstance; 00083 } 00084 00093 public function updateLastActivity (Requestable $requestInstance) { 00094 // No activity will be logged for guest accounts 00095 } 00096 00102 public function flushPendingUpdates () { 00103 // No updates will be flushed to database! 00104 } 00105 } 00106 00107 // [EOF] 00108 ?>
1.5.6