forked from GNUsocial/gnu-social
[UTIL] Add Common::array_remove_keys
This commit is contained in:
parent
e620c20bb4
commit
9291bfbecb
@ -33,6 +33,7 @@ namespace App\Util;
|
|||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Core\Router;
|
use App\Core\Router;
|
||||||
use App\Core\Security;
|
use App\Core\Security;
|
||||||
|
use Functional as F;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
|
||||||
abstract class Common
|
abstract class Common
|
||||||
@ -106,6 +107,14 @@ abstract class Common
|
|||||||
// return in_array($str, array_keys($paths));
|
// 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
|
* An internal helper function that converts a $size from php.ini for
|
||||||
* file size limit from the 'human-readable' shorthand into a int. If
|
* file size limit from the 'human-readable' shorthand into a int. If
|
||||||
|
Loading…
Reference in New Issue
Block a user