예제 #1
0
 /**
  * Accesses the Core singleton instance
  *
  * @static
  * @return Scenario_Core The core instance.
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
예제 #2
0
 /**
  * 
  * @return Scenario_Data_Consolidator 
  */
 private function _loadResults()
 {
     if ($this->_lastExperiment === null) {
         require_once 'Scenario/Exception.php';
         throw new Scenario_Exception('_loadResults called while _lastExperiment is null');
     }
     $exp = $this->_lastExperiment;
     require_once 'Scenario/Data/Consolidator.php';
     $data = new Scenario_Data_Consolidator(array());
     // get data in chunks
     $limit = 1000;
     $start = 0;
     $numresults = 0;
     do {
         $results = $this->_core->getAdapter()->GetResults($exp, $start, $limit);
         $numresults = count($results);
         $start += $limit;
         foreach ($results as $result) {
             if ($result instanceof Scenario_Result) {
                 $data->addResult($result);
             } else {
                 require_once 'Scenario/Exception.php';
                 throw new Scenario_Exception('Scenario_ResultSet must contain only Scenario_Result objects.');
             }
         }
         unset($results);
     } while ($numresults >= $limit);
     return $data;
 }
예제 #3
0
 /**
  *
  * @param string $stylesheet
  * @param Scenario_Core $core
  */
 public function __construct($stylesheet = self::AS_XML, $core = null)
 {
     // see also: html
     $this->setTranslator($stylesheet);
     if ($core == null) {
         $this->_core = Scenario_Core::getInstance();
     }
 }
예제 #4
0
 public function getCore()
 {
     if ($this->_core != null) {
         return $this->_core;
     }
     return Scenario_Core::getInstance();
 }
예제 #5
0
 /**
  * Get a safe reference to the core.
  *
  * @return Scenario_Core
  * @todo Pass a reference in upon construction rather than using the singleton.
  */
 public function getCore()
 {
     require_once 'Scenario/Core.php';
     return Scenario_Core::getInstance();
 }
예제 #6
0
 /**
  * Gets the core reference appropriate to this instance.
  *
  * @return Scenario_Core
  * @todo Use a reference to the core rather than the singleton.
  */
 public function getCore($default_to_singleton = true)
 {
     if ($this->_core == null && $default_to_singleton) {
         return Scenario_Core::getInstance();
     }
     return $this->_core;
 }