Example #1
0
 /**
  * Set the default driver for future configuration requests.
  * NOTE: This may clear any existing configuration in memory.
  * @param string $driverName
  * @return Telephony_Driver
  */
 public static function setDriver($driverName = NULL)
 {
     if ($driverName) {
         self::$driverName = $driverName;
     }
     // Drivers are always singletons, and are responsible for persistenting data for their own config generation via static vars
     // TODO: Change this for PHP 5.3, which doesn't require eval(). Don't change this until all the cool kids are on PHP 5.3*/
     if (class_exists($driverName, TRUE)) {
         self::$driver = eval('return ' . self::$driverName . '::getInstance();');
         // Return the driver object to the caller
         return self::$driver;
     } else {
         Kohana::log('debug', 'Telephony -> Driver `' . self::$driverName . '` does not exist, ignoring');
         // This class check and NULL return added by KAnderson
         // specificly because during install this class doesnt exists yet...
         self::$driver = NULL;
         return self::$driver;
     }
 }