[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 e620c20bb4
commit 9291bfbecb

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