CAS_Client::setLang PHP Method

setLang() public method

This method is used to set the language used by phpCAS.
public setLang ( string $lang ) : void
$lang string representing the language.
return void
    public function setLang($lang)
    {
        // Argument Validation
        if (gettype($lang) != 'string') {
            throw new CAS_TypeMismatchException($lang, '$lang', 'string');
        }
        phpCAS::traceBegin();
        $obj = new $lang();
        if (!$obj instanceof CAS_Languages_LanguageInterface) {
            throw new CAS_InvalidArgumentException('$className must implement the CAS_Languages_LanguageInterface');
        }
        $this->_lang = $lang;
        phpCAS::traceEnd();
    }

Usage Example

示例#1
0
文件: CAS.php 项目: DCUnit711/Demeter
 /**
  * This method is used to set the language used by phpCAS.
  *
  * @param string $lang string representing the language.
  *
  * @return void
  *
  * @sa PHPCAS_LANG_FRENCH, PHPCAS_LANG_ENGLISH
  * @note Can be called only once.
  */
 public static function setLang($lang)
 {
     phpCAS::_validateClientExists();
     try {
         self::$_PHPCAS_CLIENT->setLang($lang);
     } catch (Exception $e) {
         phpCAS::error(get_class($e) . ': ' . $e->getMessage());
     }
 }
CAS_Client