Exemple #1
0
 /**
  * Creates the display adapter using the backend passed.
  *    
  * @param string $backend The name of the backend to use.
  * @param array $config The configuration to pass to the backend.
  * @return void
  */
 public static function factory($backend, $config = array())
 {
     // Verify that backend parameters are in an array.
     if (!is_array($config)) {
         throw new ASO_Display_Exception('Backend parameters must be in an array');
     }
     // Verify that an backend name has been specified.
     if (!is_string($backend) || empty($backend)) {
         throw new ASO_Display_Exception('Backend name must be specified in a string');
     }
     // Load the backend class.
     require_once 'ASO/Display/' . $backend . '.php';
     // Create an instance of the backend, passing the config to it.
     $backendName = 'ASO_Display_' . $backend;
     self::$dispBackend = new $backendName($config);
 }