Convert values before putting into storage
@param $values Associative Array
@return Associative Array
189177
protected function convertValuesForStorage($values) {
    // filter values according to type
    foreach($values as $valueName => $value) {
      $type = $this->getAttribute($valueName)->getType();
      // integer
      if (strpos(strtolower($type), 'int') === 0) {
        $value = (strlen($value) == 0) ? null : intval($value);
        $values[$valueName] = $value;
      }
      // null values
      if ($value === null) {
        $values[$valueName] = SQLConst::NULL();
      }
    }
    return $values;
  }
1045576
private function getRsaObject(array $values)
    {
        $rsa = KeyConverter::fromArrayToRSACrypt($values);
        $encryption_mode = $this->getEncryptionMode();
        $rsa->setEncryptionMode($encryption_mode);
        if (PHPSecLibRSA::ENCRYPTION_OAEP === $encryption_mode) {
            $rsa->setHash($this->getHashAlgorithm());
            $rsa->setMGFHash($this->getHashAlgorithm());
        }

        return $rsa;
    }
1097186
public function setValuesRaw($values = array())
    {
        foreach ($values as $key => $value) {
            $this->setRaw($key, $value);
        }

        return $this;
    }
1211280
public function setValues($values=array()) {
		return $this->_addOrSetValues($values, function(HtmlTR $row,$_values){$row->setValues($_values);});
	}
933348
protected function values(array $values)
    {
        if (is_numeric(key($values))) {
            $this->insertValues[] = $values;
        } else {
            // Reorder the submitted values to match the fields array.
            foreach ($this->insertFields as $key) {
                $insert_values[$key] = $values[$key];
            }
            $this->insertValues[] = array_values($insert_values);
        }
        return $this;
    }
1154326
protected function parseArray(string $values): array
    {
        $parsed = empty($values) === false ? explode(' ', $values) : [];

        return $parsed;
    }
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;
    }
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;
    }
1122873
public static function objectToArray($values)
    {
        $results = array();
        foreach ($values as $key => $val) {
            if ($val instanceof RpayLiteObject) {
                $results[$key] = $val->__toArray(true);
            } elseif (is_array($val)) {
                $results[$key] = self::objectToArray($val);
            } else {
                $results[$key] = $val;
            }
        }
        return $results;
    }
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;
    }
264967
protected function setIsSimilarToAttribute($values)
    {
        if (is_array($values)) {
            foreach ($values as $key => $value) {
                $product = new self($value);

                $properties = $product->getProperties();

                unset($properties['@context']);

                $properties = array_filter($properties, 'strlen');

                $values[$key] = $properties;
            }
        }

        return $values;
    }
559729
static function fromArray($values)
    {
        if ($values === null) {
            return null;
        }

        ksort($values);

        $serialized = '';
        foreach ($values as $key => $value) {
            if (is_array($value)) {
                list($key, $value) = array($value[0], $value[1]);
            }

            if (strpos($key, ':') !== false) {
                return null;
            }

            if (strpos($key, "\n") !== false) {
                return null;
            }

            if (strpos($value, "\n") !== false) {
                return null;
            }
            $serialized .= "$key:$value\n";
        }
        return $serialized;
    }
1134972
public function arrayToMultiselect(array $values)
    {
        // First clean the array
        foreach ($values as $k => $v) {
            if (empty($v)) {
                unset($values[$k]);
            }
        }

        // Encode
        $values = (empty($values) ? '^^' : encodeMultienumValue($values));

        // Then return the array
        return $values;
    }
1306356
private function getUniqueValueFromArray(array $values)
    {
        $serializedValues = false;
        foreach ($values as $key => $value) {
            if (!\is_array($value)) {
                continue;
            }

            $values[$key] = \serialize($value);

            $serializedValues = true;
        }

        if (!$serializedValues) {
            return 1 === \count(\array_unique($values)) ? $values[0] : null;
        }

        return 1 === \count(\array_unique($values)) ? \unserialize($values[0], ['allowed_classes' => true]) : null;
    }
659972
private function prepareValues($value): array
    {
        if (!self::hasMultipleValues($this->name)) {
            $values = is_array($value) ? $value : [trim($value)];
        } elseif (!is_array($value)) {
            $values = explode(',', (string) $value);
        } else {
            $values = $value;
        }

        foreach (array_keys($values) as $key) {
            $values[$key] = trim($values[$key]);

            if ($values[$key] == '') {
                unset($values[$key]);
            }
        }

        return array_values(array_unique($values));
    }
114990
public function appendValues(array $values)
    {
        $appendValues = [];

        foreach ($values as $value) {
            $appendValues[] = $this->formatValue($value);
        }

        $this->message = $this->message . implode(', ', $appendValues);

        return $this;
    }
883882
protected function aggregateValues(array $values)
    {
        $max = $values[0];

        foreach ($values as $value) {
            if ($value > $max) {
                $max = $value;
            }
        }

        return $max;
    }