8 namespace Fossology\Lib\Util;
20 $uniqueValues = array_unique($allValues);
21 $valueMultiplicityMap = array();
23 foreach ($uniqueValues as $value) {
25 foreach ($allValues as $candidate) {
26 if ($value == $candidate) {
30 $valueMultiplicityMap[$value] = $count;
33 return $valueMultiplicityMap;
36 public static function callChunked(Closure $callback, $values, $chunkSize)
38 if ($chunkSize <= 0) {
39 throw new \InvalidArgumentException(
'chunk size should be positive');
42 for ($offset = 0; $offset < count($values); $offset += $chunkSize) {
43 $result = array_merge($result,
44 $callback(array_slice($values, $offset, $chunkSize)));
49 public static function multiSearch($needles,$haystack)
51 foreach ($needles as $needle) {
52 $index = array_search($needle, $haystack);
53 if ($index !==
false) {
75 return !array_diff_key(array_flip($keys), $array);
static arrayKeysExists(array $array, array $keys)
Check if a list of keys exists in associative array.
static getMultiplicityOfValues($allValues)