From b76b467436f38387fac91ff41771a036b7a68451 Mon Sep 17 00:00:00 2001 From: hide_d Date: Thu, 4 Oct 2018 02:07:31 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9C=A0=ED=8B=B8=EB=A6=AC=ED=8B=B0=20?= =?UTF-8?q?=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sammo/Json.php | 3 +++ src/sammo/Util.php | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/sammo/Json.php b/src/sammo/Json.php index 0c4797b7..88866e2d 100644 --- a/src/sammo/Json.php +++ b/src/sammo/Json.php @@ -27,6 +27,9 @@ class Json public static function decode($value) { + if($value === null){ + return null; + } return json_decode($value, true); } diff --git a/src/sammo/Util.php b/src/sammo/Util.php index 42c73fc7..afcf2398 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -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 = [];