유틸리티 함수 추가
This commit is contained in:
@@ -27,6 +27,9 @@ class Json
|
||||
|
||||
public static function decode($value)
|
||||
{
|
||||
if($value === null){
|
||||
return null;
|
||||
}
|
||||
return json_decode($value, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,6 +269,17 @@ class Util extends \utilphp\util
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function pickArrayFromArrayOfDictWithKey(array $arrayOfDict, string $key):array{
|
||||
$result = [];
|
||||
foreach($arrayOfDict as $array){
|
||||
if(!key_exist($key, $array)){
|
||||
continue;
|
||||
}
|
||||
$result[] = $array[$key];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function convertArrayToDict($arr, $keyName)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
Reference in New Issue
Block a user