Bolt\Legacy\Storage::getValidSaveData PHP Method

getValidSaveData() private method

Get a valid array to commit.
private getValidSaveData ( array $fieldvalues, array $contenttype ) : array
$fieldvalues array
$contenttype array
return array
    private function getValidSaveData(array $fieldvalues, array $contenttype)
    {
        // Clean up fields, check unneeded columns.
        foreach (array_keys($fieldvalues) as $key) {
            if ($this->isValidColumn($key, $contenttype)) {
                if (is_string($fieldvalues[$key])) {
                    // Trim strings
                    $fieldvalues[$key] = trim($fieldvalues[$key]);
                } elseif (is_bool($fieldvalues[$key])) {
                    // Convert literal booleans to 0/1 to ensure cross-db consistency
                    $fieldvalues[$key] = (int) $fieldvalues[$key];
                }
            } else {
                // unset columns we don't need to store.
                unset($fieldvalues[$key]);
            }
        }
        return $fieldvalues;
    }