정적 분석기 결과 반영. 빠진 POST 인자 입력 등
This commit is contained in:
@@ -37,7 +37,7 @@ class StringUtil
|
||||
}
|
||||
|
||||
if($currentPos + $width >= $length){
|
||||
return substr($str, $currentPos, null);
|
||||
return substr($str, $currentPos);
|
||||
}
|
||||
|
||||
for($idx = $currentPos; $idx < count($strings); $idx++){
|
||||
@@ -74,7 +74,7 @@ class StringUtil
|
||||
return $result.$endFill;
|
||||
}
|
||||
|
||||
function splitString($str, $l = 0) {
|
||||
public static function splitString($str, $l = 0) {
|
||||
//https://php.net/manual/kr/function.str-split.php#107658
|
||||
if ($l > 0) {
|
||||
$ret = array();
|
||||
@@ -99,7 +99,7 @@ class StringUtil
|
||||
$chLen = mb_strwidth($ch, 'UTF-8');
|
||||
|
||||
if($chLen == 0){
|
||||
return padString($str, $maxsize, ' ', $position);
|
||||
return static::padString($str, $maxsize, ' ', $position);
|
||||
}
|
||||
|
||||
$textLen = mb_strwidth($str, 'UTF-8');
|
||||
|
||||
+25
-8
@@ -3,6 +3,15 @@ namespace sammo;
|
||||
|
||||
class Util extends \utilphp\util
|
||||
{
|
||||
|
||||
/**
|
||||
* int 값 반환을 강제하는 부동소수점 반올림
|
||||
* @param numeric $value
|
||||
*/
|
||||
public static function round($value) : int{
|
||||
return intval(round($value));
|
||||
}
|
||||
|
||||
private static function _parseReq($value, string $type)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
@@ -233,7 +242,11 @@ class Util extends \utilphp\util
|
||||
}
|
||||
}
|
||||
|
||||
public static function eraseNullValue($dict, $depth=512)
|
||||
/**
|
||||
* @param null|mixed|mixed[] $dict
|
||||
* @return null|mixed|mixed[]
|
||||
*/
|
||||
public static function eraseNullValue($dict, int $depth=512)
|
||||
{
|
||||
//TODO:Test 추가
|
||||
if ($dict === null) {
|
||||
@@ -251,13 +264,17 @@ class Util extends \utilphp\util
|
||||
foreach ($dict as $key=>$value) {
|
||||
if ($value === null) {
|
||||
unset($dict[$key]);
|
||||
} elseif (Util::isDict($value)) {
|
||||
$newValue = Util::eraseNullValue($value, $depth - 1);
|
||||
if ($newValue === null) {
|
||||
unset($dict[$key]);
|
||||
} else {
|
||||
$dict[$key] = $newValue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!Util::isDict($value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newValue = Util::eraseNullValue($value, $depth - 1);
|
||||
if ($newValue === null) {
|
||||
unset($dict[$key]);
|
||||
} else {
|
||||
$dict[$key] = $newValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,9 @@ class WebUtil
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null|mixed|mixed[]
|
||||
*/
|
||||
public static function parseJsonPost()
|
||||
{
|
||||
// http://thisinterestsme.com/receiving-json-post-data-via-php/
|
||||
|
||||
Reference in New Issue
Block a user