public function compile_combine_functions(Contact $contact) { $this->check(); $state = new FormulaCompiler($contact); $this->_parse && $this->_parse->compile_fragments($state); $t = self::compile_body($contact, $state, null); if (count($state->fragments) == 1) { $t .= " return " . $state->fragments[0] . ";\n"; } else { $t .= " return [" . join(", ", $state->fragments) . "];\n"; } $args = '$prow, $rrow_cid, $contact, $format = 0, $forceShow = false'; self::DEBUG && Conf::msg_info(Ht::pre_text("function ({$args}) {\n // fragments " . simplify_whitespace($this->expression) . "\n {$t}}\n")); $outf = create_function($args, $t); // regroup function $state->clear(); $state->combining = 0; $expr = $this->_parse ? $this->_parse->compile($state) : "0"; $t = self::compile_body(null, $state, $expr); $args = '$groups, $format = null, $forceShow = false'; self::DEBUG && Conf::msg_info(Ht::pre_text("function ({$args}) {\n // combine " . simplify_whitespace($this->expression) . "\n {$t}}\n")); $inf = create_function($args, $t); return [$outf, $inf]; }