add property and property definition
This commit is contained in:
@@ -7,6 +7,14 @@ class AppArrayHelper
|
||||
{
|
||||
|
||||
|
||||
public static function mapValues($array, $func){
|
||||
$result = [];
|
||||
foreach ($array as $item){
|
||||
$result[] = $func($item);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function objectArrayToMap($array, $funcGetId, $funcGetValue){
|
||||
$result = [];
|
||||
|
||||
@@ -37,4 +45,11 @@ class AppArrayHelper
|
||||
);
|
||||
}
|
||||
|
||||
public static function getOrDefault($array, $key, $defaultValue = null){
|
||||
if ( isset($array[$key])){
|
||||
return $array[$key];
|
||||
}
|
||||
return $defaultValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user