Example #1
0
 /**
  * Creates a new instance of the class specified using the specified parameters
  *
  * @example $mString = MObject::newInstanceOfClass(S("mango.system.MString"), A("my string"));
  * // $mString is a new instance of MString with the value of S("my string")
  *
  * @param MString $className The fully qualified class name you wish to create an intance of
  * @param MArray $params The list of arguments to pass to the class' constructor
  *
  * @return MObject|mixed A new instance of the class specified by $className initialized with the
  * parameters specified by $params
  */
 public static function newInstanceOfClassWithParameters(MString $className, MArray $params = null)
 {
     $reflectionClass = MObject::reflectionClass($className);
     if ($params != null) {
         return $reflectionClass->newInstanceArgs($params->toArray());
     } else {
         return $reflectionClass->newInstance();
     }
 }