function message($id) { if (empty($id)) { return ''; } if (array_key_exists($id, $this->langa)) { return $this->langa[$id]; } else { if (array_key_exists($id, $this->langb)) { return $this->langb[$id]; } else { return 'Undefined message!'; } } }
function testArrayGet() { global $langde; $l10n = new L10n('de'); $this->assertEqual($langde['admin'], $l10n->message('admin')); $this->assertEqual($langde['admin'], $l10n['admin']); $this->assertEqual('Undefined message!', $l10n['bla bla']); }