public function setEncoding($encoding)
{
// fetch encodings list
$encodings = Config::get('l4gettext::encodings.list');
// sanity check
if (!in_array($encoding, $encodings)) {
throw new InvalidEncodingException("The provided encoding [{$encoding}] does not exist in the list of valid encodings [config/encodings.php]");
}
// set encoding, transform to uniform syntax
$this->encoding = $encoding;
// save locale to session
Session::put('l4gettext_encoding', $this->encoding);
// return - allow object chaining
return $this;
}