/** * Diffをテキスト形式にして取得する。 * * @param bool $diffonly trueのときは差分のみを返す。 */ function render($diffonly = false) { $ret = array(); foreach ($this->diff->getDiff() as $edit) { switch (get_class($edit)) { case 'Text_Diff_Op_copy': if (!$diffonly) { $ret[] = $this->lines(' ', $edit->orig); } break; case 'Text_Diff_Op_add': $ret[] = $this->lines('+', $edit->final); break; case 'Text_Diff_Op_delete': $ret[] = $this->lines('-', $edit->orig); break; case 'Text_Diff_Op_change': $ret[] = $this->lines('-', $edit->orig); $ret[] = $this->lines('+', $edit->final); break; default: throw FatalException("DiffRenderer: Unknown edit type"); } } return join("\n", $ret); }
protected function _NAT(&$s, &$p, $z) { // name, params if (!method_exists($this, $name = $z[1])) { // Auslagerung in Schemavariable mit benamten Argumenten throw FatalException("Native operation '{$name}' does not exist"); } // $params = ...; $s[++$p] = $this->{$name}($params); }