public function elementsNamed($name) { if ($this->_children === null) { throw new HException("bad nodetype"); } return Lambda::filter($this->_children, array(new _hx_lambda(array(&$name), "Xml_0"), 'execute'))->iterator(); }
public function handleRequest($httpContext) { $doneTrigger = new tink_core_FutureTrigger(); if (ufront_remoting_RemotingHandler_0($this, $doneTrigger, $httpContext)) { $r = $httpContext->response; $remotingResponse = null; $r->setOk(); $path = null; $args = null; try { $this->initializeContext($httpContext->injector); $params = $httpContext->request->get_params(); if (!$params->exists("__x")) { throw new HException("Remoting call did not have parameter `__x` which describes which API call to make. Aborting"); } $remotingCall = null; $s = ufront_core__MultiValueMap_MultiValueMap_Impl_::get($params, "__x"); $remotingCall = urldecode($s); $u = new haxe_Unserializer($remotingCall); $path = $u->unserialize(); $args = $u->unserialize(); $apiCallFinished = $this->executeApiCall($path, $args, $this->context, $httpContext->actionContext); $remotingResponse = tink_core__Future_Future_Impl_::map($apiCallFinished, array(new _hx_lambda(array(&$apiCallFinished, &$args, &$doneTrigger, &$httpContext, &$params, &$path, &$r, &$remotingCall, &$remotingResponse, &$u), "ufront_remoting_RemotingHandler_1"), 'execute'), null); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e = $_ex_; $error = $e; $apiNotFoundMessages = new _hx_array(array("Invalid path", "No such object", "Can't access", "No such method")); if ($path !== null && $args !== null && Std::is($e, _hx_qtype("String")) && Lambda::exists($apiNotFoundMessages, array(new _hx_lambda(array(&$apiNotFoundMessages, &$args, &$doneTrigger, &$e, &$error, &$httpContext, &$path, &$r, &$remotingResponse), "ufront_remoting_RemotingHandler_2"), 'execute'))) { $remotingResponse = tink_core__Future_Future_Impl_::sync("Unable to access " . _hx_string_or_null($path->join(".")) . " - API Not Found (" . _hx_string_or_null($error) . "). See " . Std::string($this->context->objects)); $r->setNotFound(); } else { $r->setInternalError(); $remotingResponse = tink_core__Future_Future_Impl_::sync($this->remotingError($e, $httpContext)); } } $remotingResponse(array(new _hx_lambda(array(&$args, &$doneTrigger, &$e, &$httpContext, &$path, &$r, &$remotingResponse), "ufront_remoting_RemotingHandler_3"), 'execute')); } else { $result1 = tink_core_Outcome::Success(tink_core_Noise::$Noise); if ($doneTrigger->{"list"} === null) { false; } else { $list1 = $doneTrigger->{"list"}; $doneTrigger->{"list"} = null; $doneTrigger->result = $result1; tink_core__Callback_CallbackList_Impl_::invoke($list1, $result1); tink_core__Callback_CallbackList_Impl_::clear($list1); true; } } return $doneTrigger->future; }
public function load($moduleSequence) { $_g = 0; while ($_g < $moduleSequence->length) { $path = $moduleSequence[$_g]; ++$_g; if (zcale_core_web_ModuleLoader_0($this, $_g, $moduleSequence, $path) === true && $path !== _hx_array_get(new _hx_array(array("zcale.Core", "zcale.core")), 0) && Lambda::has(zcale_core_web_ModuleLoader::$loadedModules, $path) === false) { $this->modules->push($path); } unset($path); } $this->loadNextModule(); }
public function __construct(\Twig_Node $left, \Twig_Node $right, $lineno) { parent::__construct(array('left' => $left, 'right' => $right), array(), $lineno); if ($left instanceof \Twig_Node_Expression_Name) { $this->arguments = [$left->getAttribute('name')]; } elseif ($left instanceof Arguments) { $this->arguments = $left->getArguments(); } else { throw new \InvalidArgumentException('Invalid argument\'s list for lambda.'); } if (count($this->arguments) !== count(array_flip($this->arguments))) { throw new \InvalidArgumentException('Each lambda argument must have unique name.'); } }
static function convertBeforeEncode($val) { $arr = null; if (is_object($val)) { $_g = get_class($val); switch ($_g) { case "_hx_anonymous": case "stdClass": $arr = php_Lib::associativeArrayOfObject($val); break; case "_hx_array": $arr = php_Lib::toPhpArray($val); break; case "Date": return Std::string($val); break; case "HList": $arr = php_Lib::toPhpArray(Lambda::harray($val)); break; case "_hx_enum": $e = $val; return $e->index; break; case "StringMap": case "IntMap": $arr = php_Lib::associativeArrayOfHash($val); break; default: $arr = php_Lib::associativeArrayOfObject($val); break; } } else { if (is_array($val)) { $arr = $val; } else { if (is_float($val) && !is_finite($val)) { $val = null; } return $val; } } return array_map(isset(haxe_Json::$convertBeforeEncode) ? haxe_Json::$convertBeforeEncode : array("haxe_Json", "convertBeforeEncode"), $arr); }
/** * @param array $patterns * @return \Closure */ protected static function __match(array $patterns) { return function (...$args) use($patterns) { // [a] -> Bool $patternApplies = function ($pattern) use($args) { /** @noinspection PhpParamsInspection */ return Logic::all(Arrays::zipWith(Lambda::apply(), Arrays::map(self::make(), Arrays::init($pattern)), $args)); }; try { /** @noinspection PhpParamsInspection */ $getMatchedImplementation = Lambda::compose(Arrays::last(), Arrays::first($patternApplies), Arrays::filter(function ($pattern) use($args) { return count($pattern) - 1 === count($args); })); return call_user_func_array($getMatchedImplementation($patterns), $args); } catch (\Exception $e) { throw new IncompletePatternMatchException('Incomplete pattern match expression.'); } }; }
public function load($filePath) { if (Lambda::has(zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts, $filePath) === false) { $classPath = null; $s = zcale_PathTools::removeLastElement($filePath, null); $classPath = str_replace("/", ".", $s); $cls = Type::resolveClass($classPath); if (is_object($_t = Type::typeof($cls)) && !$_t instanceof Enum ? $_t !== ValueType::$TNull : $_t != ValueType::$TNull) { try { Reflect::callMethod($cls, Reflect::field($cls, "main"), new _hx_array(array())); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $error = $_ex_; } zcale_core_web_scriptLoader_targets_SystemScriptLoader::$loadedScripts->push($filePath); $this->event->dispatch($this->eventKeys->complete); } else { $this->event->dispatchError($this->eventData, $this, "load", "Class not found: " . _hx_string_or_null($classPath)); } } else { $this->event->dispatch($this->eventKeys->complete); } }
public function prepare($where) { $wParam = _hx_explode(",", $where); $where = ""; if (Lambda::has($wParam, "filter=1")) { $wParam = $wParam->filter(array(new _hx_lambda(array(&$wParam, &$where), "model_Select_0"), 'execute')); } if ($wParam->length > 0 && $where === "") { $where = ""; } $_g = 0; while ($_g < $wParam->length) { $w = $wParam[$_g]; ++$_g; if ($where === "") { $where = "WHERE " . _hx_string_or_null($w); } else { $where = " AND " . _hx_string_or_null($w); } unset($w); } haxe_Log::trace($where, _hx_anonymous(array("fileName" => "Select.hx", "lineNumber" => 62, "className" => "model.Select", "methodName" => "prepare"))); return $where; }
public function run($args, $io = null) { if ($io === null) { $io = new coopy_TableIO(); } if ($io === null) { haxe_Log::trace("No system interface available", _hx_anonymous(array("fileName" => "Coopy.hx", "lineNumber" => 693, "className" => "coopy.Coopy", "methodName" => "run"))); return 1; } $this->init(); $this->io = $io; $more = true; $output = null; $inplace = false; $git = false; $this->flags = new coopy_CompareFlags(); $this->flags->always_show_header = true; while ($more) { $more = false; $_g1 = 0; $_g = $args->length; while ($_g1 < $_g) { $i = $_g1++; $tag = $args[$i]; if ($tag === "--output") { $more = true; $output = $args[$i + 1]; $args->splice($i, 2); break; } else { if ($tag === "--css") { $more = true; $this->fragment = true; $this->css_output = $args[$i + 1]; $args->splice($i, 2); break; } else { if ($tag === "--fragment") { $more = true; $this->fragment = true; $args->splice($i, 1); break; } else { if ($tag === "--plain") { $more = true; $this->pretty = false; $args->splice($i, 1); break; } else { if ($tag === "--all") { $more = true; $this->flags->show_unchanged = true; $this->flags->show_unchanged_columns = true; $args->splice($i, 1); break; } else { if ($tag === "--all-rows") { $more = true; $this->flags->show_unchanged = true; $args->splice($i, 1); break; } else { if ($tag === "--all-columns") { $more = true; $this->flags->show_unchanged_columns = true; $args->splice($i, 1); break; } else { if ($tag === "--act") { $more = true; if ($this->flags->acts === null) { $this->flags->acts = new haxe_ds_StringMap(); } $this->flags->acts->set($args[$i + 1], true); true; $args->splice($i, 2); break; } else { if ($tag === "--context") { $more = true; $context = Std::parseInt($args[$i + 1]); if ($context >= 0) { $this->flags->unchanged_context = $context; } $args->splice($i, 2); break; unset($context); } else { if ($tag === "--inplace") { $more = true; $inplace = true; $args->splice($i, 1); break; } else { if ($tag === "--git") { $more = true; $git = true; $args->splice($i, 1); break; } else { if ($tag === "--unordered") { $more = true; $this->flags->ordered = false; $this->flags->unchanged_context = 0; $this->order_set = true; $args->splice($i, 1); break; } else { if ($tag === "--ordered") { $more = true; $this->flags->ordered = true; $this->order_set = true; $args->splice($i, 1); break; } else { if ($tag === "--color") { $more = true; $this->flags->terminal_format = "ansi"; $args->splice($i, 1); break; } else { if ($tag === "--no-color") { $more = true; $this->flags->terminal_format = "plain"; $args->splice($i, 1); break; } else { if ($tag === "--input-format") { $more = true; $this->setFormat($args[$i + 1]); $args->splice($i, 2); break; } else { if ($tag === "--output-format") { $more = true; $this->output_format = $args[$i + 1]; $this->output_format_set = true; $args->splice($i, 2); break; } else { if ($tag === "--id") { $more = true; if ($this->flags->ids === null) { $this->flags->ids = new _hx_array(array()); } $this->flags->ids->push($args[$i + 1]); $args->splice($i, 2); break; } else { if ($tag === "--ignore") { $more = true; $this->flags->ignoreColumn($args[$i + 1]); $args->splice($i, 2); break; } else { if ($tag === "--index") { $more = true; $this->flags->always_show_order = true; $this->flags->never_show_order = false; $args->splice($i, 1); break; } else { if ($tag === "--www") { $more = true; $this->output_format = "www"; $this->output_format_set = true; $args->splice($i, 1); } else { if ($tag === "--table") { $more = true; $this->flags->addTable($args[$i + 1]); $args->splice($i, 2); break; } else { if ($tag === "-w" || $tag === "--ignore-whitespace") { $more = true; $this->flags->ignore_whitespace = true; $args->splice($i, 1); break; } else { if ($tag === "-i" || $tag === "--ignore-case") { $more = true; $this->flags->ignore_case = true; $args->splice($i, 1); break; } else { if ($tag === "--padding") { $more = true; $this->flags->padding_strategy = $args[$i + 1]; $args->splice($i, 2); break; } } } } } } } } } } } } } } } } } } } } } } } } } unset($tag, $i); } unset($_g1, $_g); } $cmd = $args[0]; if ($args->length < 2) { if ($cmd === "version") { $io->writeStdout(_hx_string_or_null(coopy_Coopy::$VERSION) . "\n"); return 0; } if ($cmd === "git") { $io->writeStdout("You can use daff to improve git's handling of csv files, by using it as a\ndiff driver (for showing what has changed) and as a merge driver (for merging\nchanges between multiple versions).\n"); $io->writeStdout("\n"); $io->writeStdout("Automatic setup\n"); $io->writeStdout("---------------\n\n"); $io->writeStdout("Run:\n"); $io->writeStdout(" daff git csv\n"); $io->writeStdout("\n"); $io->writeStdout("Manual setup\n"); $io->writeStdout("------------\n\n"); $io->writeStdout("Create and add a file called .gitattributes in the root directory of your\nrepository, containing:\n\n"); $io->writeStdout(" *.csv diff=daff-csv\n"); $io->writeStdout(" *.csv merge=daff-csv\n"); $io->writeStdout("\nCreate a file called .gitconfig in your home directory (or alternatively\nopen .git/config for a particular repository) and add:\n\n"); $io->writeStdout(" [diff \"daff-csv\"]\n"); $io->writeStdout(" command = daff diff --git\n"); $io->writeStderr("\n"); $io->writeStdout(" [merge \"daff-csv\"]\n"); $io->writeStdout(" name = daff tabular merge\n"); $io->writeStdout(" driver = daff merge --output %A %O %A %B\n\n"); $io->writeStderr("Make sure you can run daff from the command-line as just \"daff\" - if not,\nreplace \"daff\" in the driver and command lines above with the correct way\nto call it. Add --no-color if your terminal does not support ANSI colors."); $io->writeStderr("\n"); return 0; } $io->writeStderr("daff can produce and apply tabular diffs.\n"); $io->writeStderr("Call as:\n"); $io->writeStderr(" daff [--color] [--no-color] [--output OUTPUT.csv] a.csv b.csv\n"); $io->writeStderr(" daff [--output OUTPUT.html] a.csv b.csv\n"); $io->writeStderr(" daff [--output OUTPUT.csv] parent.csv a.csv b.csv\n"); $io->writeStderr(" daff [--output OUTPUT.ndjson] a.ndjson b.ndjson\n"); $io->writeStderr(" daff [--www] a.csv b.csv\n"); $io->writeStderr(" daff patch [--inplace] [--output OUTPUT.csv] a.csv patch.csv\n"); $io->writeStderr(" daff merge [--inplace] [--output OUTPUT.csv] parent.csv a.csv b.csv\n"); $io->writeStderr(" daff trim [--output OUTPUT.csv] source.csv\n"); $io->writeStderr(" daff render [--output OUTPUT.html] diff.csv\n"); $io->writeStderr(" daff copy in.csv out.tsv\n"); $io->writeStderr(" daff git\n"); $io->writeStderr(" daff version\n"); $io->writeStderr("\n"); $io->writeStderr("The --inplace option to patch and merge will result in modification of a.csv.\n"); $io->writeStderr("\n"); $io->writeStderr("If you need more control, here is the full list of flags:\n"); $io->writeStderr(" daff diff [--output OUTPUT.csv] [--context NUM] [--all] [--act ACT] a.csv b.csv\n"); $io->writeStderr(" --act ACT: show only a certain kind of change (update, insert, delete)\n"); $io->writeStderr(" --all: do not prune unchanged rows or columns\n"); $io->writeStderr(" --all-rows: do not prune unchanged rows\n"); $io->writeStderr(" --all-columns: do not prune unchanged columns\n"); $io->writeStderr(" --color: highlight changes with terminal colors (default in terminals)\n"); $io->writeStderr(" --context NUM: show NUM rows of context\n"); $io->writeStderr(" --id: specify column to use as primary key (repeat for multi-column key)\n"); $io->writeStderr(" --ignore: specify column to ignore completely (can repeat)\n"); $io->writeStderr(" --index: include row/columns numbers from original tables\n"); $io->writeStderr(" --input-format [csv|tsv|ssv|json]: set format to expect for input\n"); $io->writeStderr(" --no-color: make sure terminal colors are not used\n"); $io->writeStderr(" --ordered: assume row order is meaningful (default for CSV)\n"); $io->writeStderr(" --output-format [csv|tsv|ssv|json|copy|html]: set format for output\n"); $io->writeStderr(" --padding [dense|sparse|smart]: set padding method for aligning columns\n"); $io->writeStderr(" --table NAME: compare the named table, used with SQL sources\n"); $io->writeStderr(" --unordered: assume row order is meaningless (default for json formats)\n"); $io->writeStderr(" -w / --ignore-whitespace: ignore changes in leading/trailing whitespace\n"); $io->writeStderr(" -i / --ignore-case: ignore differences in case\n"); $io->writeStderr("\n"); $io->writeStderr(" daff render [--output OUTPUT.html] [--css CSS.css] [--fragment] [--plain] diff.csv\n"); $io->writeStderr(" --css CSS.css: generate a suitable css file to go with the html\n"); $io->writeStderr(" --fragment: generate just a html fragment rather than a page\n"); $io->writeStderr(" --plain: do not use fancy utf8 characters to make arrows prettier\n"); $io->writeStderr(" --www: send output to a browser\n"); return 1; } $cmd1 = $args[0]; $offset = 1; if (!Lambda::has(new _hx_array(array("diff", "patch", "merge", "trim", "render", "git", "version", "copy")), $cmd1)) { if (_hx_index_of($cmd1, ".", null) !== -1 || _hx_index_of($cmd1, "--", null) === 0) { $cmd1 = "diff"; $offset = 0; } } if ($cmd1 === "git") { $types = $args->splice($offset, $args->length - $offset); return $this->installGitDriver($io, $types); } if ($git) { $ct = $args->length - $offset; if ($ct !== 7 && $ct !== 9) { $io->writeStderr("Expected 7 or 9 parameters from git, but got " . _hx_string_rec($ct, "") . "\n"); return 1; } $git_args = $args->splice($offset, $ct); $args->splice(0, $args->length); $offset = 0; $old_display_path = $git_args[0]; $new_display_path = $git_args[0]; $old_file = $git_args[1]; $new_file = $git_args[4]; if ($ct === 9) { $io->writeStdout($git_args[8]); $new_display_path = $git_args[7]; } $io->writeStdout("--- a/" . _hx_string_or_null($old_display_path) . "\n"); $io->writeStdout("+++ b/" . _hx_string_or_null($new_display_path) . "\n"); $args->push($old_file); $args->push($new_file); } $parent = null; if ($args->length - $offset >= 3) { $parent = $this->loadTable($args[$offset]); $offset++; } $aname = $args[$offset]; $a = $this->loadTable($aname); $b = null; if ($args->length - $offset >= 2) { if ($cmd1 !== "copy") { $b = $this->loadTable($args[1 + $offset]); } else { $output = $args[1 + $offset]; } } $this->flags->diff_strategy = $this->strategy; if ($inplace) { if ($output !== null) { $io->writeStderr("Please do not use --inplace when specifying an output.\n"); } $output = $aname; return 1; } if ($output === null) { $output = "-"; } $ok = true; if ($cmd1 === "diff") { if (!$this->order_set) { $this->flags->ordered = $this->order_preference; if (!$this->flags->ordered) { $this->flags->unchanged_context = 0; } } $this->flags->allow_nested_cells = $this->nested_output; $this->runDiff($parent, $a, $b, $this->flags, $output); } else { if ($cmd1 === "patch") { $patcher = new coopy_HighlightPatch($a, $b, null); $patcher->apply(); $this->saveTable($output, $a, null); } else { if ($cmd1 === "merge") { $merger = new coopy_Merger($parent, $a, $b, $this->flags); $conflicts = $merger->apply(); $ok = $conflicts === 0; if ($conflicts > 0) { $io->writeStderr(_hx_string_rec($conflicts, "") . " conflict" . _hx_string_or_null($conflicts > 1 ? "s" : "") . "\n"); } $this->saveTable($output, $a, null); } else { if ($cmd1 === "trim") { $this->saveTable($output, $a, null); } else { if ($cmd1 === "render") { $this->renderTable($output, $a); } else { if ($cmd1 === "copy") { $this->saveTable($output, $a, null); } } } } } } if ($ok) { return 0; } else { return 1; } }
static function dispatch($param) { $cl = Type::resolveClass("model." . Std::string($param->get("className"))); if ($cl === null) { haxe_Log::trace("model." . Std::string($param->get("className")) . " ???", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 66, "className" => "Model", "methodName" => "dispatch"))); return false; } $fl = Reflect::field($cl, "create"); if ($fl === null) { haxe_Log::trace(Std::string($cl) . "create is null", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 73, "className" => "Model", "methodName" => "dispatch"))); return false; } $iFields = Type::getInstanceFields($cl); if (Lambda::has($iFields, $param->get("action"))) { haxe_Log::trace("calling create " . Std::string($cl), _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 80, "className" => "Model", "methodName" => "dispatch"))); return Reflect::callMethod($cl, $fl, new _hx_array(array($param))); } else { haxe_Log::trace("not calling create ", _hx_anonymous(array("fileName" => "Model.hx", "lineNumber" => 85, "className" => "Model", "methodName" => "dispatch"))); return false; } }
public function addCond($where, $phValues) { if ($where->length === 0) { return ""; } $sb = new StringBuf(); $first = true; $_g = 0; while ($_g < $where->length) { $w = $where[$_g]; ++$_g; $wData = _hx_string_call($w, "split", array("|")); $values = $wData->slice(2, null); $filter_tables = null; if (Util::any2bool($this->param) && $this->param->exists("filter_tables") && Util::any2bool($this->param->get("filter_tables"))) { $jt = $this->param->get("filter_tables"); $filter_tables = _hx_explode(",", $jt); unset($jt); } haxe_Log::trace(Std::string($wData) . ":" . _hx_string_or_null($this->joinTable) . ":" . Std::string($filter_tables), _hx_anonymous(array("fileName" => "ClientHistory.hx", "lineNumber" => 53, "className" => "model.ClientHistory", "methodName" => "addCond"))); if (_hx_deref(new EReg("^pay_[a-zA-Z_]+\\.", ""))->match($wData[0]) && _hx_array_get(_hx_explode(".", $wData[0]), 0) !== $this->joinTable) { continue; } if ($first) { $sb->add(" WHERE "); $first = false; } else { $sb->add(" AND "); } $_g1 = strtoupper($wData[1]); switch ($_g1) { case "BETWEEN": if (!($values->length === 2) && Lambda::hforeach($values, array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$values, &$w, &$wData, &$where), "model_ClientHistory_0"), 'execute'))) { S::hexit("BETWEEN needs 2 values - got only:" . _hx_string_or_null($values->join(","))); } $sb->add($this->quoteField($wData[0])); $sb->add(" BETWEEN ? AND ?"); $phValues->push(new _hx_array(array($wData[0], $values[0]))); $phValues->push(new _hx_array(array($wData[0], $values[1]))); break; case "IN": $sb->add($this->quoteField($wData[0])); $sb->add(" IN("); $sb->add($values->map(array(new _hx_lambda(array(&$_g, &$_g1, &$filter_tables, &$first, &$phValues, &$sb, &$values, &$w, &$wData, &$where), "model_ClientHistory_1"), 'execute'))->join(",")); $sb->add(")"); break; case "LIKE": $sb->add($this->quoteField($wData[0])); $sb->add(" LIKE ?"); $phValues->push(new _hx_array(array($wData[0], $wData[2]))); break; default: $sb->add($this->quoteField($wData[0])); if (_hx_deref(new EReg("^(<|>)", ""))->match($wData[1])) { $eR = new EReg("^(<|>)", ""); $eR->match($wData[1]); $val = Std::parseFloat($eR->matchedRight()); $sb->add(_hx_string_or_null($eR->matched(0)) . "?"); $phValues->push(new _hx_array(array($wData[0], $val))); continue 2; } if ($wData[1] === "NULL") { $sb->add(" IS NULL"); } else { $sb->add(" = ?"); $phValues->push(new _hx_array(array($wData[0], $wData[1]))); } break; } unset($_g1); unset($wData, $w, $values, $filter_tables); } return $sb->b; }
function lam() { $args = func_get_args(); $p = new Lambda($args[0], $args[1]); return $p->evaluate(); }
function ufront_view_UFViewEngine_2(&$_g, &$ext, &$finalPath, &$path, &$templatingEngine, &$testNextEngine, &$testNextEngine1, &$tplEngines, &$tplStrReady) { if ($tplEngines->length > 0) { $engine = $tplEngines->shift(); if (Lambda::has($engine->extensions, $ext)) { $finalPath = $path; $this3 = $_g->getTemplateString($finalPath); $this3(array(new _hx_lambda(array(&$_g, &$engine, &$ext, &$finalPath, &$path, &$templatingEngine, &$testNextEngine, &$testNextEngine1, &$this3, &$tplEngines, &$tplStrReady), "ufront_view_UFViewEngine_6"), 'execute')); } else { call_user_func($testNextEngine1); } } else { $result12 = tink_core_Outcome::Failure(new tink_core_TypedError(null, "No templating engine found for " . _hx_string_or_null($path) . " (None support extension " . _hx_string_or_null($ext) . ")", _hx_anonymous(array("fileName" => "UFViewEngine.hx", "lineNumber" => 134, "className" => "ufront.view.UFViewEngine", "methodName" => "getTemplate")))); if ($tplStrReady->{"list"} === null) { false; } else { $list9 = $tplStrReady->{"list"}; $tplStrReady->{"list"} = null; $tplStrReady->result = $result12; tink_core__Callback_CallbackList_Impl_::invoke($list9, $result12); tink_core__Callback_CallbackList_Impl_::clear($list9); true; } } }
public function alignCore2($align, $a, $b) { if ($align->meta === null) { $align->meta = new coopy_Alignment(); } $this->alignColumns($align->meta, $a, $b); $column_order = $align->meta->toOrder(); $align->range($a->get_height(), $b->get_height()); $align->tables($a, $b); $align->setRowlike(true); $w = $a->get_width(); $ha = $a->get_height(); $hb = $b->get_height(); $av = $a->getCellView(); $ids = null; $ignore = null; if ($this->comp->compare_flags !== null) { $ids = $this->comp->compare_flags->ids; $ignore = $this->comp->compare_flags->getIgnoredColumns(); } $common_units = new _hx_array(array()); $ra_header = $align->getSourceHeader(); $rb_header = $align->getSourceHeader(); $_g = 0; $_g1 = $column_order->getList(); while ($_g < $_g1->length) { $unit = $_g1[$_g]; ++$_g; if ($unit->l >= 0 && $unit->r >= 0 && $unit->p !== -1) { if ($ignore !== null) { if ($unit->l >= 0 && $ra_header >= 0 && $ra_header < $a->get_height()) { $name = $av->toString($a->getCell($unit->l, $ra_header)); if ($ignore->exists($name)) { continue; } unset($name); } if ($unit->r >= 0 && $rb_header >= 0 && $rb_header < $b->get_height()) { $name1 = $av->toString($b->getCell($unit->r, $rb_header)); if ($ignore->exists($name1)) { continue; } unset($name1); } } $common_units->push($unit); } unset($unit); } $index_top = null; $pending_ct = $ha; $reverse_pending_ct = $hb; $used = new haxe_ds_IntMap(); $used_reverse = new haxe_ds_IntMap(); if ($ids !== null) { $index_top = new coopy_IndexPair($this->comp->compare_flags); $ids_as_map = new haxe_ds_StringMap(); $_g2 = 0; while ($_g2 < $ids->length) { $id = $ids[$_g2]; ++$_g2; $ids_as_map->set($id, true); true; unset($id); } $_g3 = 0; while ($_g3 < $common_units->length) { $unit1 = $common_units[$_g3]; ++$_g3; $na = $av->toString($a->getCell($unit1->l, 0)); $nb = $av->toString($b->getCell($unit1->r, 0)); if ($ids_as_map->exists($na) || $ids_as_map->exists($nb)) { $index_top->addColumns($unit1->l, $unit1->r); $align->addIndexColumns($unit1); } unset($unit1, $nb, $na); } $index_top->indexTables($a, $b, 1); if ($this->indexes !== null) { $this->indexes->push($index_top); } $_g4 = 0; while ($_g4 < $ha) { $j = $_g4++; $cross = $index_top->queryLocal($j); $spot_a = $cross->spot_a; $spot_b = $cross->spot_b; if ($spot_a !== 1 || $spot_b !== 1) { continue; } $jb = $cross->item_b->lst[0]; $align->link($j, $jb); $used->set($jb, 1); if (!$used_reverse->exists($j)) { $reverse_pending_ct--; } $used_reverse->set($j, 1); unset($spot_b, $spot_a, $jb, $j, $cross); } } else { $N = 5; $columns = new _hx_array(array()); if ($common_units->length > $N) { $columns_eval = new _hx_array(array()); $_g11 = 0; $_g5 = $common_units->length; while ($_g11 < $_g5) { $i = $_g11++; $ct = 0; $mem = new haxe_ds_StringMap(); $mem2 = new haxe_ds_StringMap(); $ca = _hx_array_get($common_units, $i)->l; $cb = _hx_array_get($common_units, $i)->r; $_g21 = 0; while ($_g21 < $ha) { $j1 = $_g21++; $key = $av->toString($a->getCell($ca, $j1)); if (!$mem->exists($key)) { $mem->set($key, 1); $ct++; } unset($key, $j1); } unset($_g21); $_g22 = 0; while ($_g22 < $hb) { $j2 = $_g22++; $key1 = $av->toString($b->getCell($cb, $j2)); if (!$mem2->exists($key1)) { $mem2->set($key1, 1); $ct++; } unset($key1, $j2); } unset($_g22); $columns_eval->push(new _hx_array(array($i, $ct))); unset($mem2, $mem, $i, $ct, $cb, $ca); } $sorter = array(new _hx_lambda(array(&$N, &$a, &$align, &$av, &$b, &$column_order, &$columns, &$columns_eval, &$common_units, &$ha, &$hb, &$ids, &$ignore, &$index_top, &$pending_ct, &$ra_header, &$rb_header, &$reverse_pending_ct, &$used, &$used_reverse, &$w), "coopy_CompareTable_0"), 'execute'); $columns_eval->sort($sorter); $columns = Lambda::harray(Lambda::map($columns_eval, array(new _hx_lambda(array(&$N, &$a, &$align, &$av, &$b, &$column_order, &$columns, &$columns_eval, &$common_units, &$ha, &$hb, &$ids, &$ignore, &$index_top, &$pending_ct, &$ra_header, &$rb_header, &$reverse_pending_ct, &$sorter, &$used, &$used_reverse, &$w), "coopy_CompareTable_1"), 'execute'))); $columns = $columns->slice(0, $N); } else { $_g12 = 0; $_g6 = $common_units->length; while ($_g12 < $_g6) { $i1 = $_g12++; $columns->push($i1); unset($i1); } } $top = Math::round(Math::pow(2, $columns->length)); $pending = new haxe_ds_IntMap(); $_g7 = 0; while ($_g7 < $ha) { $j3 = $_g7++; $pending->set($j3, $j3); unset($j3); } $added_columns = new haxe_ds_IntMap(); $index_ct = 0; $_g8 = 0; while ($_g8 < $top) { $k = $_g8++; if ($k === 0) { continue; } if ($pending_ct === 0) { break; } $active_columns = new _hx_array(array()); $kk = $k; $at = 0; while ($kk > 0) { if (_hx_mod($kk, 2) === 1) { $active_columns->push($columns[$at]); } $kk >>= 1; $at++; } $index = new coopy_IndexPair($this->comp->compare_flags); $_g23 = 0; $_g13 = $active_columns->length; while ($_g23 < $_g13) { $k1 = $_g23++; $col = $active_columns[$k1]; $unit2 = $common_units[$col]; $index->addColumns($unit2->l, $unit2->r); if (!$added_columns->exists($col)) { $align->addIndexColumns($unit2); $added_columns->set($col, true); } unset($unit2, $k1, $col); } unset($_g23, $_g13); $index->indexTables($a, $b, 1); if ($k === $top - 1) { $index_top = $index; } $h = $a->get_height(); if ($b->get_height() > $h) { $h = $b->get_height(); } if ($h < 1) { $h = 1; } $wide_top_freq = $index->getTopFreq(); $ratio = $wide_top_freq; $ratio /= $h + 20; if ($ratio >= 0.1) { if ($index_ct > 0 || $k < $top - 1) { continue; } } $index_ct++; if ($this->indexes !== null) { $this->indexes->push($index); } $fixed = new _hx_array(array()); if (null == $pending) { throw new HException('null iterable'); } $__hx__it = $pending->keys(); while ($__hx__it->hasNext()) { unset($j4); $j4 = $__hx__it->next(); $cross1 = $index->queryLocal($j4); $spot_a1 = $cross1->spot_a; $spot_b1 = $cross1->spot_b; if ($spot_a1 !== 1 || $spot_b1 !== 1) { continue; } $val = $cross1->item_b->lst[0]; if (!$used->exists($val)) { $fixed->push($j4); $align->link($j4, $val); $used->set($val, 1); if (!$used_reverse->exists($j4)) { $reverse_pending_ct--; } $used_reverse->set($j4, 1); } unset($val, $spot_b1, $spot_a1, $cross1); } $_g24 = 0; $_g14 = $fixed->length; while ($_g24 < $_g14) { $j5 = $_g24++; $pending->remove($fixed[$j5]); $pending_ct--; unset($j5); } unset($_g24, $_g14); unset($wide_top_freq, $ratio, $kk, $k, $index, $h, $fixed, $at, $active_columns); } } if ($index_top !== null) { $offset = 0; $scale = 1; $_g9 = 0; while ($_g9 < 2) { $sgn = $_g9++; if ($pending_ct > 0) { $xb = null; if ($scale === -1 && $hb > 0) { $xb = $hb - 1; } $_g15 = 0; while ($_g15 < $ha) { $xa0 = $_g15++; $xa = $xa0 * $scale + $offset; $xb2 = $align->a2b($xa); if ($xb2 !== null) { $xb = $xb2 + $scale; if ($xb >= $hb || $xb < 0) { break; } continue; } if ($xb === null) { continue; } $ka = $index_top->localKey($xa); $kb = $index_top->remoteKey($xb); if ($ka !== $kb) { continue; } if ($used->exists($xb)) { continue; } $align->link($xa, $xb); $used->set($xb, 1); $used_reverse->set($xa, 1); $pending_ct--; $xb += $scale; if ($xb >= $hb || $xb < 0) { break; } if ($pending_ct === 0) { break; } unset($xb2, $xa0, $xa, $kb, $ka); } unset($_g15); unset($xb); } $offset = $ha - 1; $scale = -1; unset($sgn); } $offset = 0; $scale = 1; $_g10 = 0; while ($_g10 < 2) { $sgn1 = $_g10++; if ($reverse_pending_ct > 0) { $xa1 = null; if ($scale === -1 && $ha > 0) { $xa1 = $ha - 1; } $_g16 = 0; while ($_g16 < $hb) { $xb0 = $_g16++; $xb1 = $xb0 * $scale + $offset; $xa2 = $align->b2a($xb1); if ($xa2 !== null) { $xa1 = $xa2 + $scale; if ($xa1 >= $ha || $xa1 < 0) { break; } continue; } if ($xa1 === null) { continue; } $ka1 = $index_top->localKey($xa1); $kb1 = $index_top->remoteKey($xb1); if ($ka1 !== $kb1) { continue; } if ($used_reverse->exists($xa1)) { continue; } $align->link($xa1, $xb1); $used->set($xb1, 1); $used_reverse->set($xa1, 1); $reverse_pending_ct--; $xa1 += $scale; if ($xa1 >= $ha || $xa1 < 0) { break; } if ($reverse_pending_ct === 0) { break; } unset($xb1, $xb0, $xa2, $kb1, $ka1); } unset($_g16); unset($xa1); } $offset = $hb - 1; $scale = -1; unset($sgn1); } } $_g17 = 1; while ($_g17 < $ha) { $i2 = $_g17++; if (!$used_reverse->exists($i2)) { $align->link($i2, -1); } unset($i2); } $_g18 = 1; while ($_g18 < $hb) { $i3 = $_g18++; if (!$used->exists($i3)) { $align->link(-1, $i3); } unset($i3); } if ($ha > 0 && $hb > 0) { $align->link(0, 0); } }
public function customRequest($post, $api, $sock = null, $method = null) { $this->responseData = null; $url_regexp = new EReg("^(https?://)?([a-zA-Z\\.0-9_-]+)(:[0-9]+)?(.*)\$", ""); if (!$url_regexp->match($this->url)) { $this->onError("Invalid URL"); return; } $secure = $url_regexp->matched(1) === "https://"; if ($sock === null) { if ($secure) { $sock = new php_net_SslSocket(); } else { $sock = new sys_net_Socket(); } } $host = $url_regexp->matched(2); $portString = $url_regexp->matched(3); $request = $url_regexp->matched(4); if ($request === "") { $request = "/"; } $port = null; if ($portString === null || $portString === "") { if ($secure) { $port = 443; } else { $port = 80; } } else { $port = Std::parseInt(_hx_substr($portString, 1, strlen($portString) - 1)); } $data = null; $multipart = _hx_field($this, "file") !== null; $boundary = null; $uri = null; if ($multipart) { $post = true; $boundary = Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000)) . Std::string(Std::random(1000)); while (strlen($boundary) < 38) { $boundary = "-" . _hx_string_or_null($boundary); } $b = new StringBuf(); if (null == $this->params) { throw new HException('null iterable'); } $__hx__it = $this->params->iterator(); while ($__hx__it->hasNext()) { unset($p); $p = $__hx__it->next(); $b->add("--"); $b->add($boundary); $b->add("\r\n"); $b->add("Content-Disposition: form-data; name=\""); $b->add($p->param); $b->add("\""); $b->add("\r\n"); $b->add("\r\n"); $b->add($p->value); $b->add("\r\n"); } $b->add("--"); $b->add($boundary); $b->add("\r\n"); $b->add("Content-Disposition: form-data; name=\""); $b->add($this->file->param); $b->add("\"; filename=\""); $b->add($this->file->filename); $b->add("\""); $b->add("\r\n"); $b->add("Content-Type: " . _hx_string_or_null($this->file->mimeType) . "\r\n" . "\r\n"); $uri = $b->b; } else { if (null == $this->params) { throw new HException('null iterable'); } $__hx__it = $this->params->iterator(); while ($__hx__it->hasNext()) { unset($p1); $p1 = $__hx__it->next(); if ($uri === null) { $uri = ""; } else { $uri .= "&"; } $uri .= _hx_string_or_null(rawurlencode($p1->param)) . "=" . _hx_string_or_null(rawurlencode($p1->value)); } } $b1 = new StringBuf(); if ($method !== null) { $b1->add($method); $b1->add(" "); } else { if ($post) { $b1->add("POST "); } else { $b1->add("GET "); } } if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) { $b1->add("http://"); $b1->add($host); if ($port !== 80) { $b1->add(":"); $b1->add($port); } } $b1->add($request); if (!$post && $uri !== null) { if (_hx_index_of($request, "?", 0) >= 0) { $b1->add("&"); } else { $b1->add("?"); } $b1->add($uri); } $b1->add(" HTTP/1.1\r\nHost: " . _hx_string_or_null($host) . "\r\n"); if ($this->postData !== null) { $b1->add("Content-Length: " . _hx_string_rec(strlen($this->postData), "") . "\r\n"); } else { if ($post && $uri !== null) { if ($multipart || !Lambda::exists($this->headers, array(new _hx_lambda(array(&$api, &$b1, &$boundary, &$data, &$host, &$method, &$multipart, &$port, &$portString, &$post, &$request, &$secure, &$sock, &$uri, &$url_regexp), "haxe_Http_5"), 'execute'))) { $b1->add("Content-Type: "); if ($multipart) { $b1->add("multipart/form-data"); $b1->add("; boundary="); $b1->add($boundary); } else { $b1->add("application/x-www-form-urlencoded"); } $b1->add("\r\n"); } if ($multipart) { $b1->add("Content-Length: " . _hx_string_rec(strlen($uri) + $this->file->size + strlen($boundary) + 6, "") . "\r\n"); } else { $b1->add("Content-Length: " . _hx_string_rec(strlen($uri), "") . "\r\n"); } } } if (null == $this->headers) { throw new HException('null iterable'); } $__hx__it = $this->headers->iterator(); while ($__hx__it->hasNext()) { unset($h1); $h1 = $__hx__it->next(); $b1->add($h1->header); $b1->add(": "); $b1->add($h1->value); $b1->add("\r\n"); } $b1->add("\r\n"); if ($this->postData !== null) { $b1->add($this->postData); } else { if ($post && $uri !== null) { $b1->add($uri); } } try { if (_hx_field(_hx_qtype("haxe.Http"), "PROXY") !== null) { $sock->connect(new sys_net_Host(haxe_Http::$PROXY->host), haxe_Http::$PROXY->port); } else { $sock->connect(new sys_net_Host($host), $port); } $sock->write($b1->b); if ($multipart) { $bufsize = 4096; $buf = haxe_io_Bytes::alloc($bufsize); while ($this->file->size > 0) { $size = null; if ($this->file->size > $bufsize) { $size = $bufsize; } else { $size = $this->file->size; } $len = 0; try { $len = $this->file->io->readBytes($buf, 0, $size); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; if (($e = $_ex_) instanceof haxe_io_Eof) { break; } else { throw $__hx__e; } } $sock->output->writeFullBytes($buf, 0, $len); $this->file->size -= $len; unset($size, $len, $e); } $sock->write("\r\n"); $sock->write("--"); $sock->write($boundary); $sock->write("--"); } $this->readHttpResponse($api, $sock); $sock->close(); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e1 = $_ex_; try { $sock->close(); } catch (Exception $__hx__e) { $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e; $e2 = $_ex_; } $this->onError(Std::string($e1)); } }
static function hasRtti($c) { return Lambda::has(Type::getClassFields($c), "__rtti"); }
public function __construct(\Twig_Node $node, $lineno) { parent::__construct(array('node' => $node), array(), $lineno); }
function model_Clients_18(&$_e, &$account, &$q, $pred) { return Lambda::count($_e, $pred); }