Netson\L4gettext\L4gettext::setEncoding PHP Méthode

setEncoding() public méthode

method to set the encoding
public setEncoding ( string $encoding ) : L4gettext
$encoding string
Résultat L4gettext
    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;
    }