コード例 #1
0
ファイル: diff.inc.php プロジェクト: riaf/kinowiki
 /**
  * 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);
 }
コード例 #2
0
ファイル: interpreter.php プロジェクト: dapepe/tymio
 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);
 }