Example #1
0
 public function accepts(Type $type) : bool
 {
     if ($type instanceof MixedType) {
         return true;
     }
     if ($this->isNullable() && $type instanceof NullType) {
         return true;
     }
     if ($type instanceof StaticType) {
         return $this->checkSubclassAcceptability($type->getBaseClass());
     }
     if ($type->getClass() === null) {
         return false;
     }
     return $this->checkSubclassAcceptability($type->getClass());
 }
Example #2
0
 public function accepts(Type $type) : bool
 {
     if ($type instanceof IterableType) {
         return $this->getItemType()->accepts($type->getItemType());
     }
     if ($type->getClass() !== null && $this->exists($type->getClass())) {
         $classReflection = new \ReflectionClass($type->getClass());
         return $classReflection->implementsInterface(\Traversable::class);
     }
     if ($type instanceof MixedType) {
         return true;
     }
     if ($this->isNullable() && $type instanceof NullType) {
         return true;
     }
     return false;
 }
Example #3
0
 static function isObject($v)
 {
     if ($v === null) {
         return false;
     }
     if (is_object($v)) {
         return $v instanceof _hx_anonymous || Type::getClass($v) !== null;
     }
     return is_string($v) && !_hx_is_lambda($v);
 }
 public function injectInto($target)
 {
     $info = $this->getInfo(Type::getClass($target));
     if ($info === null) {
         return;
     }
     $_g = 0;
     $_g1 = $info->fields;
     while ($_g < $_g1->length) {
         $field = $_g1[$_g];
         ++$_g;
         $field->applyInjection($target, $this);
         unset($field);
     }
 }
 public function executeResult($context)
 {
     try {
         return $context->actionContext->actionResult->executeResult($context->actionContext);
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $p_methodName = "executeResult";
         $p_lineNumber = -1;
         $p_fileName = "";
         $p_customParams = new _hx_array(array("actionContext"));
         $p_className = Type::getClassName(Type::getClass($context->actionContext));
         return tink_core__Future_Future_Impl_::sync(tink_core_Outcome::Failure(ufront_web_HttpError::wrap($e, null, _hx_anonymous(array("fileName" => "MVCHandler.hx", "lineNumber" => 70, "className" => "ufront.web.MVCHandler", "methodName" => "executeResult")))));
     }
 }
Example #6
0
 public function accepts(Type $type) : bool
 {
     if ($type instanceof self) {
         return true;
     }
     if ($this->isNullable() && $type instanceof NullType) {
         return true;
     }
     if ($type instanceof ArrayType && $type->isPossiblyCallable()) {
         return true;
     }
     if ($type->getClass() === 'Closure') {
         return true;
     }
     return $type instanceof MixedType;
 }
 public function isEditorLicensed()
 {
     $licenseClass = Type::resolveClass("com.wiris.util.sys.License");
     if ($licenseClass !== null) {
         $init = Reflect::field($licenseClass, "init");
         $initMethodParams = new _hx_array(array());
         $initMethodParams->push($this->getConfiguration()->getProperty(com_wiris_plugin_api_ConfigurationKeys::$EDITOR_KEY, ""));
         $initMethodParams->push("");
         $initMethodParams->push(new _hx_array(array(4, 5, 9, 10)));
         Reflect::callMethod($licenseClass, $init, $initMethodParams);
         $isLicensedMethod = Reflect::field($licenseClass, "isLicensed");
         $isLicensedObject = Reflect::callMethod($licenseClass, $isLicensedMethod, null);
         $isLicensed = null;
         if (_hx_index_of(Type::getClassName(Type::getClass($isLicensedObject)), "Boolean", null) !== -1) {
             $isLicensed = _hx_string_call($isLicensedObject, "toString", array());
         } else {
             $isLicensed = $isLicensedObject;
         }
         return $isLicensed;
     }
     return false;
 }
 public function executeApiCall($path, $args, $remotingContext, $actionContext)
 {
     if ($remotingContext->objects->exists($path[0]) === false) {
         throw new HException("Invalid path " . _hx_string_or_null($path->join(".")));
     }
     $actionContext->handler = $this;
     $actionContext->action = $path[$path->length - 1];
     $actionContext->controller = $remotingContext->objects->get($path[0])->obj;
     $actionContext->args = $args;
     $returnType = null;
     try {
         $fieldsMeta = haxe_rtti_Meta::getFields(Type::getClass($actionContext->controller));
         $actionMeta = Reflect::field($fieldsMeta, $actionContext->action);
         $returnType = $actionMeta->returnType[0];
     } catch (Exception $__hx__e) {
         $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
         $e = $_ex_;
         $returnType = 0;
     }
     $flags = $returnType;
     $result = $remotingContext->call($path, $args);
     if (($flags & 1 << ufront_api_ApiReturnType::$ARTFuture->index) !== 0) {
         return $result;
     } else {
         if (($flags & 1 << ufront_api_ApiReturnType::$ARTVoid->index) !== 0) {
             return tink_core__Future_Future_Impl_::sync(null);
         } else {
             return tink_core__Future_Future_Impl_::sync($result);
         }
     }
 }
 public function toString()
 {
     return Type::getClassName(Type::getClass($this));
 }
Example #10
0
 static function isArray($arr)
 {
     if (Type::getClassName(Type::getClass($arr)) === "Array") {
         return true;
     } else {
         return false;
     }
 }
Example #11
0
 public function encodeImpl($sb, $o)
 {
     if (com_wiris_system_TypeTools::isHash($o)) {
         $this->encodeHash($sb, $o);
     } else {
         if (com_wiris_system_TypeTools::isArray($o)) {
             $this->encodeArray($sb, $o);
         } else {
             if (Std::is($o, _hx_qtype("String"))) {
                 $this->encodeString($sb, $o);
             } else {
                 if (Std::is($o, _hx_qtype("Int"))) {
                     $this->encodeInteger($sb, $o);
                 } else {
                     if (Std::is($o, _hx_qtype("haxe.Int64"))) {
                         $this->encodeLong($sb, $o);
                     } else {
                         if (Std::is($o, _hx_qtype("com.wiris.util.json.JSonIntegerFormat"))) {
                             $this->encodeIntegerFormat($sb, $o);
                         } else {
                             if (Std::is($o, _hx_qtype("Bool"))) {
                                 $this->encodeBoolean($sb, $o);
                             } else {
                                 if (Std::is($o, _hx_qtype("Float"))) {
                                     $this->encodeFloat($sb, $o);
                                 } else {
                                     throw new HException("Impossible to convert to json object of type " . Std::string(Type::getClass($o)));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #12
0
 public function addCrumb($instance, $methodName = null)
 {
     $classPath = Type::getClassName(Type::getClass($instance));
     $this->data->error->crumbs->push(_hx_anonymous(array("classPath" => $classPath, "methodName" => $methodName)));
 }
function ufront_app_HttpApplication_12(&$_g, &$ctx, &$doneTrigger, &$err, &$errHandlerModules, &$resMidModules, $m2)
{
    $b2 = _hx_anonymous(array("methodName" => "log", "lineNumber" => -1, "fileName" => "", "customParams" => new _hx_array(array("httpContext", "appMessages")), "className" => Type::getClassName(Type::getClass($m2))));
    return new tink_core_MPair(ufront_app_HttpApplication_25($__hx__this, $_g, $b2, $ctx, $doneTrigger, $err, $errHandlerModules, $m2, $resMidModules), $b2);
}
 static function fakePosition($obj, $method, $args = null)
 {
     return _hx_anonymous(array("methodName" => $method, "lineNumber" => -1, "fileName" => "", "customParams" => $args, "className" => Type::getClassName(Type::getClass($obj))));
 }
Example #15
0
 static function dumpObjectRsafe($ob, $i = null)
 {
     $tClass = Type::getClass($ob);
     $m = "dumpObjectRsafe:" . Std::string($ob !== null ? Type::getClass($ob) : $ob) . "\n";
     $names = new _hx_array(array());
     if (Type::getClass($ob) !== null) {
         $names = Type::getInstanceFields(Type::getClass($ob));
     } else {
         $names = Reflect::fields($ob);
     }
     if (Type::getClass($ob) !== null) {
         $m = _hx_string_or_null(Type::getClassName(Type::getClass($ob))) . ":\n";
     }
     $_g = 0;
     while ($_g < $names->length) {
         $name = $names[$_g];
         ++$_g;
         try {
             $t = Std::string(Type::typeof(Reflect::field($ob, $name)));
             if (me_cunity_debug_Out::$skipFunctions && $t === "TFunction") {
                 null;
             }
             if ($name === "parentView" || $name === "ContextMenu" || $name === "cMenu") {
                 $m .= _hx_string_or_null($name) . ":" . Std::string($ob->parentView->id) . "\n";
             } else {
                 $m .= _hx_string_or_null($name) . ":" . Std::string(Reflect::field($ob, $name)) . ":" . _hx_string_or_null($t) . "\n";
             }
             unset($t);
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $ex = $_ex_;
             $m .= _hx_string_or_null($name) . ":" . Std::string($ex);
         }
         unset($name, $ex);
     }
     me_cunity_debug_Out::_trace($m, $i);
 }