From 275d9b1c25cf35d2a4baad6a2929b65e59d1448f Mon Sep 17 00:00:00 2001 From: hide_d Date: Fri, 1 Jun 2018 03:01:06 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=9C=EC=9E=90=20=EC=BC=80=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EC=9A=B0=ED=9A=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sammo/JosaUtil.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sammo/JosaUtil.php b/src/sammo/JosaUtil.php index 2046bd46..c0b2cfa9 100644 --- a/src/sammo/JosaUtil.php +++ b/src/sammo/JosaUtil.php @@ -517,15 +517,12 @@ class JosaUtil{ return true; } - public static function check(string $text, string $type=''){ + public static function check(string $text, string $type){ JosaUtil::init(); $htarget = preg_replace(JosaUtil::REG_INVALID_CHAR_W_HANJA, ' ', $text); $htarget = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $htarget); - $target = preg_replace(JosaUtil::REG_INVALID_CHAR, ' ', $text); - $target = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $target); - if(!$htarget){ return false; } @@ -543,9 +540,14 @@ class JosaUtil{ if(\key_exists($hcode, \sammo\JosaUtil::$jongsungHanja)){ return true; } - return false; + if($hcode < JosaUtil::KO_START_CODE || JosaUtil::KO_FINISH_CODE < $hcode){ + return false; + } } + $target = preg_replace(JosaUtil::REG_INVALID_CHAR, ' ', $text); + $target = preg_replace(JosaUtil::REG_TARGET_CHAR, '$1', $target); + $code = StringUtil::splitString($target); $code = $code[count($code)-1]; $code = StringUtil::uniord($code);