modifs.mineures sans commentaires
This commit is contained in:
parent
0887f53dc4
commit
ba8a51dae8
13
src/cl.php
13
src/cl.php
|
@ -557,6 +557,19 @@ class cl {
|
|||
return $mapped;
|
||||
}
|
||||
|
||||
/**
|
||||
* indiquer si {@link self::rekey()} modifierai le tableau indiqué (s'il y a
|
||||
* des modifications à faire)
|
||||
*/
|
||||
static function would_rekey(?array $array, ?array $mappings, bool $inverse=false): bool {
|
||||
if ($array === null || $mappings === null) return false;
|
||||
if ($inverse) $mappings = array_flip($mappings);
|
||||
foreach ($array as $key => $value) {
|
||||
if (array_key_exists($key, $mappings)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#############################################################################
|
||||
|
||||
/** tester si tous les éléments du tableau satisfont la condition */
|
||||
|
|
Loading…
Reference in New Issue