Exemple #1
0
 /**
 	@param	$typePreferences [type,...]
 */
 function load($typePreferences = null)
 {
     $this->typePreferences = $typePreferences ? (array) $typePreferences : $this->typePreferences;
     foreach ((array) $this->typePreferences as $type) {
         if (self::$types[$type]) {
             $class = new \ReflectionClass(self::$types[$type]);
             $this->under = $class->newInstanceArgs(array_slice(func_get_args(), 1));
             if ($this->under->_success) {
                 $this->type = $type;
                 break;
             }
         }
     }
     if (!$this->under) {
         Debug::toss(__CLASS__ . ' Failed to get under with preferences: ' . Debug::toString($this->typePreferences));
     }
 }