Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Service/DeveloperGarden/Credential.php
Go to the documentation of this file.
00001 <?php
00031 class Zend_Service_DeveloperGarden_Credential
00032 {
00038     protected $_username = null;
00039 
00045     protected $_password = null;
00046 
00052     protected $_realm = 't-online.de';
00053 
00062     public function __construct($username = null, $password = null, $realm = null)
00063     {
00064         if (!empty($username)) {
00065             $this->setUsername($username);
00066         }
00067         if (!empty($password)) {
00068             $this->setPassword($password);
00069         }
00070         if (!empty($realm)) {
00071             $this->setRealm($realm);
00072         }
00073     }
00074 
00082     public function setPassword($password = null)
00083     {
00084         if (empty($password)) {
00085             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00086             throw new Zend_Service_DeveloperGarden_Client_Exception('Empty password not permitted.');
00087         }
00088 
00089         if (!is_string($password)) {
00090             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00091             throw new Zend_Service_DeveloperGarden_Client_Exception('Password must be a string.');
00092         }
00093 
00094         $this->_password = $password;
00095         return $this;
00096     }
00097 
00103     public function getPassword()
00104     {
00105         return $this->_password;
00106     }
00107 
00115     public function setUsername($username = null)
00116     {
00117         if (empty($username)) {
00118             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00119             throw new Zend_Service_DeveloperGarden_Client_Exception('Empty username not permitted.');
00120         }
00121 
00122         if (!is_string($username)) {
00123             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00124             throw new Zend_Service_DeveloperGarden_Client_Exception('Username must be a string.');
00125         }
00126 
00127         $this->_username = $username;
00128         return $this;
00129     }
00130 
00140     public function getUsername($withRealm = false)
00141     {
00142         $retValue = $this->_username;
00143         if ($withRealm) {
00144             $retValue = sprintf(
00145                 '%s@%s',
00146                 $this->_username,
00147                 $this->_realm
00148             );
00149         }
00150         return $retValue;
00151     }
00152 
00160     public function setRealm($realm = null)
00161     {
00162         if (empty($realm)) {
00163             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00164             throw new Zend_Service_DeveloperGarden_Client_Exception('Empty realm not permitted.');
00165         }
00166 
00167         if (!is_string($realm)) {
00168             require_once 'Zend/Service/DeveloperGarden/Client/Exception.php';
00169             throw new Zend_Service_DeveloperGarden_Client_Exception('Realm must be a string.');
00170         }
00171 
00172         $this->_realm = $realm;
00173         return $this;
00174     }
00175 
00181     public function getRealm()
00182     {
00183         return $this->_realm;
00184     }
00185 }
00186 
 All Data Structures Namespaces Files Functions Variables Enumerations