@param $values

@return array
495714
private function getMostFrequentValues($values)
    {
        // remove false values (while keeping zeros)
        $values = array_filter($values, 'strlen');

        // array_count_values requires strings or integer, convert floats to string (mysqli)
        foreach ($values as &$value) {
            if (is_numeric($value)) {
                $value = (string)round($value, 3);
            }
        }
        // we have a list of all values. let's show the most frequently used first.
        $values = array_count_values($values);

        // Sort this list by converting and sorting the array with custom method, so the result doesn't differ between PHP versions
        $sortArray = [];

        foreach ($values as $value => $count) {
            $sortArray[] = [
                'value' => $value,
                'count' => $count
            ];
        }

        usort($sortArray, function($a, $b) {
            if ($a['count'] == $b['count']) {
                return strcmp($a['value'], $b['value']);
            }

            return $a['count'] > $b['count'] ? -1 : 1;
        });

        return array_column($sortArray, 'value');
    }
758927
protected function aggregateValues(array $values)
    {
        $min = $values[0];

        foreach ($values as $value) {
            if ($value < $min) {
                $min = $value;
            }
        }

        return $min;
    }
23828
public function tryGetOptionsForValues(array $values): array
    {
        $objects = $this->objects->tryGetAll($values);

        $options = [];

        foreach ($objects as $index => $object) {
            $id        = $this->getObjectIdentity($index, $object);
            $options[] = $this->getFieldOptionForObject($object, $id);
        }

        return $options;
    }
1097465
protected function forceStringValues(array $values)
    {
        foreach ($values as $key => $value) {
            $values[$key] = (string) $value;
        }

        return $values;
    }
731501
public static function convertMaestranoObjectToArray($values)
  {
    $results = array();
    foreach ($values as $k => $v) {
      // FIXME: this is an encapsulation violation
      if ($k[0] == '_') {
        continue;
      }

      // Convert key to underscore
      $kReal = self::toUnderscore($k);

      if ($v instanceof Maestrano_Api_Object) {
        $results[$kReal] = $v->__toArray(true);
      } else if (is_array($v)) {
        $results[$kReal] = self::convertMaestranoObjectToArray($v);
      } else if ($v instanceOf DateTime) {
        $results[$kReal] = $v->format(Maestrano_Helper_DateTime::ISO8601);
      } else {
        $results[$kReal] = $v;
      }
    }
    return $results;
  }
900510
final public function escapeValues (array $values) : array
	{
		$sanitizedValues = [];
		foreach ($values as $key => $value):
			$key 					= $this->escapeValue($key);
			$sanitizedValues[$key]  = (is_array($value)) ? $this->escapeValues($value) : $this->escapeValue($value);
		endforeach;
		return $sanitizedValues;
	}
848382
protected function getParametersList(array $values)
    {
        $parameters = [];

        foreach ($values as $name => $value) {
            $parameters[$name] = sprintf(
                "$*::%s",
                $this->getStructure()->getTypeFor($name)
            );
        }

        return $parameters;
    }
1217795
public function convert(array $values)
    {
        $tmp = [];

        foreach ($values as $key => $value) {
            $tmp[strtolower($key)] = $value;
        }

        return $this->hydrate($tmp);
    }
332873
public static function getNonEmptyValues(array $values)
    {
        /*
         * No values?
         * Nothing to do
         */
        if (empty($values)) {
            return null;
        }

        return array_filter($values, function ($value) {
            $nonEmptyScalar = is_scalar($value) && '' !== $value;
            $nonEmptyArray = is_array($value) && !empty($value);

            return $nonEmptyScalar || $nonEmptyArray || is_object($value);
        });
    }
1039906
public function prepareValues($values)
    {
        if (empty($values)) {
            return [];
        }

        if (!is_array($values)) {
            $values = (array)$values;
        }

        $values = array_filter($values, 'is_scalar');
        $values = array_map('self::quoteValue', $values);

        return $values;
    }
630508
public static function parseAttributes($values)
    {
        $result = array();
        $values = trim($values, " \t\n\r\0\x0B()");
        $parts  = explode(',', $values);

        foreach ($parts as $part) {
            $kv    = explode('=', $part, 2);
            $key   = trim($kv[0]);
            $value = isset($kv[1]) ? $kv[1] : '';
            $value = trim($value, " \t\n\r\0\x0B\"");

            if (!empty($key)) {
                $result[$key] = $value;
            }
        }

        return $result;
    }
186213
public function toKeyValue(array $values)
    {
        $result = [];

        foreach ($values as $key => $value) {
            if (is_array($value)) {
                $result[$key] = $this->toKeyValue($value);
            } elseif (is_object($value)) {
                $result[$key] = $this->toKeyValue((array) $value);
            } else {
                $result[$key] = $value;
            }
        }

        return $result;
    }
290694
public function stripVOID($Values)
    {
        if (!is_array($Values)) {
            return [];
        }
        $Result = [];
        foreach ($Values as $Value) {
            if ($Value != VOID) {
                $Result[] = $Value;
            }
        }
        return $Result;
    }
1126653
public function preparedResults($values)
    {
        $preparedValues = [];

        /* @var $col Col */
        /* @var $field Field */
        foreach ($this->select as $pos => $selectColumn) {
            $col = $selectColumn[0];
            $field = $col->getOutputField();
            $val = ArrayHelper::getValue($values, $pos);
            // first use the inbuilt converters
            try {
                $val = Type::getType(
                    $field->dbType($this->connection)
                )->convertToPHPValue($val, $this->connection->getDatabasePlatform());
            } catch (DBALException $exception) {
            }

            // use the field converters if any were provided by the user.
            $converters = $field->getDbConverters($this->connection);

            if ($converters) {
                foreach ($converters as $converter) {
                    $val = call_user_func($converter, $this->connection, $val, $field);
                }
            }
            $preparedValues[] = $val;
        }

        return $preparedValues;
    }
1214381
protected function getValues(array $values)
    {
        $array = [];

        $versionedKeys = array_merge(
            $this->model->getVersionedAttributeNames(),
            [$this->model->getLatestVersionColumn(), $this->model->getVersionColumn(), $this->model->getVersionKeyName()]
        );

        foreach ($values as $key => $value) {
            if (! $this->isVersionedKey($key, $versionedKeys)) {
                $array[$key] = $value;
            }
        }

        return $array;
    }
590086
public function choicesForValue(array $values = []): array
    {
        $choices = $this->choices();
        $selected = [];
        foreach ($values as $value) {
            if (array_key_exists($value, $this->choices)) {
                $selected[$value] = $choices[$value];
            }
        }

        return $selected;
    }
433326
public function getFlatMap(array $values)
	{
		$result = [];
		foreach ($values as $key => $value) {
			self::applyValueProcessors($key, $value);
			$result[$key] = $value;
		}
		return $result;
	}