Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 require_once(dirname(__FILE__).'/../ProxiedService.php');
00032 require_once(dirname(__FILE__).'/Testable.php');
00033 include_once(dirname(__FILE__).'/../InvalidArgumentException.php');
00034 include_once(dirname(__FILE__).'/../OutOfSequenceException.php');
00035
00036
00041 abstract class CAS_ProxiedService_Abstract
00042 implements CAS_ProxiedService, CAS_ProxiedService_Testable
00043 {
00044
00049 private $_proxyTicket;
00050
00059 public function setProxyTicket ($proxyTicket) {
00060 if (empty($proxyTicket))
00061 throw new CAS_InvalidArgumentException("Trying to initialize with an empty proxy ticket.");
00062 if (!empty($this->_proxyTicket))
00063 throw new CAS_OutOfSequenceException('Already initialized, cannot change the proxy ticket.');
00064
00065 $this->_proxyTicket = $proxyTicket;
00066 }
00067
00074 protected function getProxyTicket () {
00075 if (empty($this->_proxyTicket))
00076 throw new CAS_OutOfSequenceException('No proxy ticket yet. Call $this->initializeProxyTicket() to aquire the proxy ticket.');
00077
00078 return $this->_proxyTicket;
00079 }
00080
00084 private $_casClient;
00085
00097 public function setCasClient (CAS_Client $casClient) {
00098 if (!empty($this->_proxyTicket))
00099 throw new CAS_OutOfSequenceException('Already initialized, cannot change the CAS_Client.');
00100
00101 $this->_casClient = $casClient;
00102 }
00103
00113 protected function initializeProxyTicket() {
00114 if (!empty($this->_proxyTicket))
00115 throw new CAS_OutOfSequenceException('Already initialized, cannot initialize again.');
00116
00117
00118 if (empty($this->_casClient))
00119 phpCAS::initializeProxiedService($this);
00120 else
00121 $this->_casClient->initializeProxiedService($this);
00122 }
00123
00124 }