[UTIL] Add Common::array_remove_keys

This commit is contained in:
Hugo Sales 2020-07-30 22:48:24 +00:00 committed by Hugo Sales
parent fe3a3978af
commit 3e6eb114c4
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0

View File

@ -33,6 +33,7 @@ namespace App\Util;
use App\Core\DB\DB;
use App\Core\Router;
use App\Core\Security;
use Functional as F;
use Symfony\Component\Security\Core\User\UserInterface;
abstract class Common
@ -106,6 +107,14 @@ abstract class Common
// return in_array($str, array_keys($paths));
}
/**
* Remove keys from the _values_ of $keys from the array $from
*/
public static function array_remove_keys(array $from, array $keys, bool $strict = false)
{
return F\filter($from, function ($e) use ($keys, $strict) { return in_array($e, $keys, $strict); });
}
/**
* An internal helper function that converts a $size from php.ini for
* file size limit from the 'human-readable' shorthand into a int. If