Beispiel #1
0
 static function createEmptyInstance($cl)
 {
     if ($cl->__qname__ === "Array") {
         return new _hx_array(array());
     }
     if ($cl->__qname__ === "String") {
         return "";
     }
     try {
         php_Boot::$skip_constructor = true;
         $rfl = $cl->__rfl__();
         if ($rfl === null) {
             return null;
         }
         $m = $rfl->getConstructor();
         $nargs = $m->getNumberOfRequiredParameters();
         $i = null;
         if ($nargs > 0) {
             $args = array_fill(0, $m->getNumberOfRequiredParameters(), null);
             $i = $rfl->newInstanceArgs($args);
         } else {
             $i = $rfl->newInstanceArgs(array());
         }
         php_Boot::$skip_constructor = false;
         return $i;
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         php_Boot::$skip_constructor = false;
         throw new HException("Unable to instantiate " . Std::string($cl));
     }
     return null;
 }