ISSN 값 유효성 체크한다.
https://en.wikipedia.org/wiki/International_Standard_Serial_Number#Code_format
@param $issn
@throws MsgException
328357
public static function checkIssn($issn)
    {
        $issn = trim(StringUtils::removeHyphen($issn));

        if (mb_strlen($issn) !== 8 || preg_match('/0{8}/', $issn)) {
            throw new MsgException('ISSN 형식에 맞지 않습니다.');
        }

        $total = 0;

        for ($i = 0; $i < 7; $i++) {
            $digit = intval(substr($issn, $i, 1));
            $total += ((8 - $i) * $digit);
        }

        $check_sum = 11 - ($total % 11);
        if ($check_sum === 10) {
            $check_sum = 'X';
        }

        if ($check_sum != substr($issn, -1)) {
            throw new MsgException("ISSN 형식에 맞지 않습니다.");
        }
    }
178282
public function updateEntries($msgid, $translation)
    {
        if (
            !isset($this->entriesAsArrays[$msgid])
            || !is_array($translation)
            || sizeof($translation) != sizeof($this->entriesAsArrays[$msgid]['msgstr'])
        ) {
            throw new \Exception('Cannot update entry translation');
        }
        $this->removeFuzzyFlagForMsgId($msgid);
        $this->entriesAsArrays[$msgid]['msgstr'] = $translation;
    }
73325
public function setEncoding($encoding)
    {
        if ($encoding !== null) {
            if (!function_exists('mb_strtoupper')) {
                $ex = new \Exception('mbstring extension is required for value mutating.');
                throw $ex;
            }

            $encoding = (string) $encoding;
            if (!in_array(strtolower($encoding), array_map('strtolower', mb_list_encodings()))) {
                $ex = new \Exception('The given encoding '.$encoding.' is not supported by mbstring ext.');
                throw $ex;
            }
        }

        $this->encoding = $encoding;
        return $this;
    }
411304
public final void mSFIXED32() throws RecognitionException {
        try {
            int _type = SFIXED32;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // com/dyuproject/protostuff/parser/ProtoLexer.g:187:5: ( 'sfixed32' )
            // com/dyuproject/protostuff/parser/ProtoLexer.g:187:9: 'sfixed32'
            {
            match("sfixed32"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
691988
protected function setError(string $msg)
    {
        $this->error = $msg;
        $lastError = error_get_last();
        if ($lastError !== null) {
            $this->errorDetail = sprintf(
                "'%s' in %s on line %s",
                $lastError['message'],
                $lastError['file'],
                $lastError['line']
            );
        }
    }
706987
public function checksum($value)
    {
        if (strlen($value) == 8) {
            $this->_checksum = '_issn';
        } else {
            $this->_checksum = '_gtin';
        }

        return parent::checksum($value);
    }
632513
public static function checkIsbn13Number($isbn)
    {
        $isbn = trim($isbn);
        if (mb_strlen($isbn) !== 13 || preg_match('/0{13}/', $isbn)) {
            throw new MsgException("ISBN13 형식에 맞지 않습니다.");
        }

        if (!is_numeric($isbn)) {
            throw new MsgException('ISBN13 형식에 맞지 않습니다.');
        }

        $total = 0;

        for ($i = 0; $i < 12; $i++) {
            $digit = intval(substr($isbn, $i, 1));
            $total += ($i % 2 === 0) ? $digit : $digit * 3;
        }

        $check_sum = 10 - ($total % 10);
        if ($check_sum === 10) {
            $check_sum = 0;
        }

        if ($check_sum !== intval(substr($isbn, -1))) {
            throw new MsgException("ISBN13 형식에 맞지 않습니다.");
        }
    }
1250433
protected function sendTextMsgToJsonString(WxSendTextMsg $msg)
    {
        $formatStr = '{
                        "touser":"%s",
                        "msgtype":"%s",
                        "text":
                        {
                             "content":"%s"
                        }
                    }';
        $result = sprintf($formatStr,   $msg->getToUserName(),
                                        $msg->getMsgType(),
                                        $msg->getContent()
                        );


        return $result;
    }
192807
public function setHMS($h, $m, $s, $ms = 0)
    {
        if (is_int($h) === false) {
            throw new MWrongTypeException("\$h", "int", gettype($h));
        }

        if (is_int($m) === false) {
            throw new MWrongTypeException("\$m", "int", gettype($m));
        }

        if (is_int($s) === false) {
            throw new MWrongTypeException("\$s", "int", gettype($s));
        }

        if (is_int($ms) === false) {
            throw new MWrongTypeException("\$ms", "int", gettype($ms));
        }

        $this->mseconds = $ms + ($s * 1000) + ($m * 60 * 1000) + ($h * 60 * 60 * 1000);
    }
369505
public static function checkMinLength($field, $minLength, $msg)
    {
        if ((StringUtils::isEmpty($field) === false) && mb_strlen($field) < $minLength) {
            throw new MsgException($msg);
        }
    }
792831
public static function checkDatetimeFormat($field, $format, $msg)
    {
        $date = date($format, strtotime($field));
        if ($field !== $date) {
            throw new MsgException($msg);
        }
    }
391116
private function error($msg)
    {
        if (class_exists('\sasco\LibreDTE\Estado') and class_exists('\sasco\LibreDTE\Log')) {
            $msg = \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::FIRMA_ERROR, $msg);
            \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::FIRMA_ERROR, $msg);
            return false;
        } else {
            throw new \Exception($msg);
        }
    }
1042450
public final void mEXPONENT() throws RecognitionException {
		try {
			// hql.g:871:2: ( ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+ )
			// hql.g:871:4: ( 'e' ) ( '+' | '-' )? ( '0' .. '9' )+
			{
			// hql.g:871:4: ( 'e' )
			// hql.g:871:5: 'e'
			{
			match('e'); if (state.failed) return;
			}

			// hql.g:871:10: ( '+' | '-' )?
			int alt21=2;
			int LA21_0 = input.LA(1);
			if ( (LA21_0=='+'||LA21_0=='-') ) {
				alt21=1;
			}
			switch (alt21) {
				case 1 :
					// hql.g:
					{
					if ( input.LA(1)=='+'||input.LA(1)=='-' ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

			}

			// hql.g:871:21: ( '0' .. '9' )+
			int cnt22=0;
			loop22:
			while (true) {
				int alt22=2;
				int LA22_0 = input.LA(1);
				if ( ((LA22_0 >= '0' && LA22_0 <= '9')) ) {
					alt22=1;
				}

				switch (alt22) {
				case 1 :
					// hql.g:
					{
					if ( (input.LA(1) >= '0' && input.LA(1) <= '9') ) {
						input.consume();
						state.failed=false;
					}
					else {
						if (state.backtracking>0) {state.failed=true; return;}
						MismatchedSetException mse = new MismatchedSetException(null,input);
						recover(mse);
						throw mse;
					}
					}
					break;

				default :
					if ( cnt22 >= 1 ) break loop22;
					if (state.backtracking>0) {state.failed=true; return;}
					EarlyExitException eee = new EarlyExitException(22, input);
					throw eee;
				}
				cnt22++;
			}

			}

		}
		finally {
			// do for sure before leaving
		}
	}
96666
protected function throwError($msg = null)
    {
        if ($this->sourceLoc >= 0) {
            $this->sourceParser->throwError($msg, $this->sourceLoc);
        }
        throw new exception($msg);
    }
277141
public function setDMS($string)
    {

        $string = preg_replace(
            "/[^a-zA-Z0-9,.\s]/",
            ' ',
            trim($string)
        );

        $string = str_replace(
            array('S', 'N', 'E', 'W'),
            array(' S', ' N', ' E', ' W'),
            strtoupper($string)
        );

        $string = preg_replace(
            '/\s+/',
            ' ',
            $string
        );

        $this->dms = explode(' ',$string);
    }
510983
private function formatGs1128() {
        $formatedText = '~F1';
        $formatedLabel = '';
        $c = count($this->identifiersId);

        for ($i = 0; $i < $c; $i++) {
            if ($i > 0) {
                $formatedLabel .= ' ';
            }

            if ($this->identifiersId[$i] !== null) {
                $formatedLabel .= '(' . $this->identifiersId[$i] . ')';
            }

            $formatedText .= $this->identifiersId[$i];

            $formatedLabel .= $this->identifiersContent[$i];
            $formatedText .= $this->identifiersContent[$i];

            if (isset($this->identifiersAi[$this->identifiersId[$i]])) {
                $ai_data = $this->identifiersAi[$this->identifiersId[$i]];
            } elseif (isset($this->identifiersId[$i][3])) {
                $identifierWithVar = substr($this->identifiersId[$i], 0, -1) . 'y';
                $ai_data = isset($this->identifiersAi[$identifierWithVar]) ? $this->identifiersAi[$identifierWithVar] : null;
            } else {
                $ai_data = null;
            }

            /* We'll check if we need to add a ~F1 (<GS>) char */
            /* If we use the legacy mode, we always add a ~F1 (<GS>) char between AIs */
            if ($ai_data !== null) {
                if ((strlen($this->identifiersContent[$i]) < $ai_data[self::MAXLENGTH] && ($i + 1) !== $c) || (!$this->strictMode && ($i + 1) !== $c)) {
                    $formatedText .= '~F1';
                }
            } elseif ($this->allowsUnknownIdentifier && $this->identifiersId[$i] === null && ($i + 1) !== $c) {
                /* If this id is unknown, we add a ~F1 (<GS>) char */
                $formatedText .= '~F1';
            }
        }

        if ($this->noLengthLimit === false && (strlen(str_replace('~F1', chr(29), $formatedText)) - 1) > self::MAX_GS1128_CHARS) {
            throw new CINParseException('gs1128', 'The barcode can\'t contain more than ' . self::MAX_GS1128_CHARS . ' characters.');
        }

        $this->label = $formatedLabel;
        return $formatedText;
    }
1332048
public function notRegexp($pattern, $msg)
    {
        if(preg_match($pattern, (string)$this->_value)) {
            $this->_errors[] = $msg;
        }
        return $this;
    }