library/core/class.factory.php
protected function _InstantiateObject($Alias, $ClassName, $Args = NULL) {
      if(is_null($Args)) $Args = array();
      $Result = NULL;

      // Instantiate the object with the correct arguments.
      // This odd looking case statement is purely for speed optimization.
      switch(count($Args)) {
         case 0:
            $Result = new $ClassName; break;
         case 1:
            $Result = new $ClassName($Args[0]); break;
         case 2:
            $Result = new $ClassName($Args[0], $Args[1]); break;
         case 3:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2]); break;
         case 4:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3]); break;
         case 5:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4]); break;
         case 6:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5]); break;
         case 7:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6]); break;
         case 8:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7]); break;
         default:
            throw new Exception();
      }

      $this->_SetDependancies($Alias, $Result);
      return $Result;
   }
protected function _InstantiateObject($Alias, $ClassName, $Args = NULL) {
      if(is_null($Args)) $Args = array();
      $Result = NULL;

      // Instantiate the object with the correct arguments.
      // This odd looking case statement is purely for speed optimization.
      switch(count($Args)) {
         case 0:
            $Result = new $ClassName; break;
         case 1:
            $Result = new $ClassName($Args[0]); break;
         case 2:
            $Result = new $ClassName($Args[0], $Args[1]); break;
         case 3:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2]); break;
         case 4:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3]); break;
         case 5:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4]); break;
         case 6:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5]); break;
         case 7:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6]); break;
         case 8:
            $Result = new $ClassName($Args[0], $Args[1], $Args[2], $Args[3], $Args[4], $Args[5], $Args[6], $Args[7]); break;
         default:
            throw new Exception();
      }

      $this->_SetDependancies($Alias, $Result);
      return $Result;
   }
protected function _InstantiateObject ( $ Alias , $ ClassName , $ Args = NULL ) { if ( is_null ( $ Args ) ) $ Args = array ( ) ; $ Result = NULL ; // Instantiate the object with the correct arguments. // This odd looking case statement is purely for speed optimization. switch ( count ( $ Args ) ) { case 0 : $ Result = new $ ClassName ; break ; case 1 : $ Result = new $ ClassName ( $ Args [ 0 ] ) ; break ; case 2 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] ) ; break ; case 3 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] ) ; break ; case 4 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] , $ Args [ 3 ] ) ; break ; case 5 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] , $ Args [ 3 ] , $ Args [ 4 ] ) ; break ; case 6 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] , $ Args [ 3 ] , $ Args [ 4 ] , $ Args [ 5 ] ) ; break ; case 7 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] , $ Args [ 3 ] , $ Args [ 4 ] , $ Args [ 5 ] , $ Args [ 6 ] ) ; break ; case 8 : $ Result = new $ ClassName ( $ Args [ 0 ] , $ Args [ 1 ] , $ Args [ 2 ] , $ Args [ 3 ] , $ Args [ 4 ] , $ Args [ 5 ] , $ Args [ 6 ] , $ Args [ 7 ] ) ; break ; default : throw new Exception ( ) ; } $ this -> _SetDependancies ( $ Alias , $ Result ) ; return $ Result ; }
Instantiate a new object.

@param string $ClassName The name of the class to instantiate.
@param array $Args The arguments to pass to the constructor.
Note: This function currently only supports a maximum of 8 arguments.
Instantiate a new object .