예제 #1
0
 /**
  * Sets the current error code
  *
  * @param  integer $code  One of the error constants in this class
  *
  * @throws \InvalidArgumentException If the code is not one of the error constants in this class
  */
 public static function setErrorCode($code)
 {
     if (!isset(self::$errorMessages[$code])) {
         throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
     }
     self::$errorCode = $code;
 }
예제 #2
0
파일: StubIntl.php 프로젝트: hykz/Depot
 /**
  * Sets the current error
  *
  * @param integer $code    One of the error constants in this class
  * @param string  $message The ICU class error message
  *
  * @throws \InvalidArgumentException If the code is not one of the error constants in this class
  */
 public static function setError($code, $message = '')
 {
     if (!isset(self::$errorCodes[$code])) {
         throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code));
     }
     self::$errorMessage = $message ? sprintf('%s: %s', $message, self::$errorCodes[$code]) : self::$errorCodes[$code];
     self::$errorCode = $code;
 }