function druckstatusR(&$r) { $tname = $r->RecordSource; if (IsNull($tname)) { $tname = 'Keine Tabelle'; } if (Left($tname, 7) == 'SELECT ') { $tname = 'SQL direkt'; } if (!is_a($r, 'AmberObject')) { $Rname = 'Falscher Parameter!!!'; } else { $Rname = $r->Name; } $d = ' am ' . Format(Now(), 'ddd dd.mmm.yyyy') . ' um ' . Format(Now(), 'hh.nn'); $s = $_SERVER['SERVER_NAME']; return 'Bericht: [' . $Rname . '] Tabelle/Abfrage: (' . $tname . ')' . $d . ' Server: [' . $s . ']'; }
/** * Converts Some to a Right, else it becomes a Left containing the return of $left * @param callable $left a function holder for some alternative value * @return Left|Right */ public function toRight(callable $left) { return $this->isEmpty() ? Left(call_user_func($left)) : Right($this->get()); }
function testLeft() { $this->assertEquals('as', Left("asdf", 2), 'Test1'); $this->assertEquals('', Left("asdf", 0), 'Test2'); }