/** * construct controller object * * @param none * @return none */ public function __construct() { /* start preparing the virgin soap message */ $this->soapMessage = array(); $this->soapMessage['request'] = array(); /* initialize a logger object */ $this->logger = betfairLogger::getInstance(); /* set up the Soap dialoge */ $this->prepareDialogue(); // If I have a sessionToken cached, skip the login $sessionTokenCache = betfairCache::fetch('sessionToken'); if (FALSE == $sessionTokenCache) { /* otherwise, log this controller in before we do anything else */ $loginresult = $this->login(); $sessionToken = $loginresult->Result->header->sessionToken; $this->dialogue->setSessionToken($sessionToken); } /* at this point, I have either logged in and retrieved a sesssion, or I have a sessionToken * in cache and so will add it to the soap message in the contructRequest method. * * @TODO The betfairDialogue should be extended * to check for session expiries in all responses and purge the sessionToken cache element, which * would then force a re-login when this controller gets reinstantiated */ }
/** * Retrieve the session token last received * * @return string representing lastest provided session token */ public function getSessionToken() { return betfairCache::fetch('sessionToken'); }