/** * 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 */ }
/** * return an instance of this class. Ensure only one instance exists for a given request * * @return betfairDialogue object instance */ public static function getInstance() { if (!isset(self::$instance)) { $c = __CLASS__; self::$instance = new $c(); } /* initialize the logger for this instance */ $logger = betfairLogger::getInstance(); return self::$instance; }
protected function setUp() { $this->logger = betfairLogger::getInstance(); $this->message = "\nthis is a test " . rand(); }
public function __construct() { $this->logger = betfairLogger::getInstance(); }