Tag values with a language (if possible)

@param array $values Values

@return array Language tagged values
497011
protected static function tagLanguage(array $values)
    {
        $lang   = null;
        $values = self::createLanguage($values, $lang);

        return $lang ? array_map(function($value) use ($lang) {
            return (object)['value' => $value, 'lang' => $lang];
        }, $values) : $values;
    }
479783
public function setFromArray(array $values) {
        foreach ($values as $key => $val) {
            $this->set($key, $val);
        }
        return $this;
    }
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;
    }
4252
public function groupQueryValues(array $values)
    {
        $joined = Resources::EMPTY_STRING;

        foreach ($values as $value) {
            if (!is_null($value) && !empty($value)) {
                $joined .= $value.Resources::SEPARATOR;
            }
        }

        return trim($joined, Resources::SEPARATOR);
    }
1209268
protected function getListValues($values)
    {
        // Empty values
        if (empty($values)) {
            return array();
        }

        // Direct array
        if (is_array($values)) {
            return array_values($values);
        }

        // Extract lists
        if ($values instanceof SS_List) {
            return $values->column('ID');
        }

        return array(trim($values));
    }
1307351
public function values(array $values)
    {
        foreach( $values as $k => $v ) {
            $this->value($k, $v);
        }
        return $this;
    }
868649
public function process(array $values)
    {
        $results = [];

        foreach ($values as $value) {
            list($rootPageUid, $mountPoint) = GeneralUtility::trimExplode(',',
                $value, true, 2);
            $results[] = $this->getSolrRootlineForPageId($rootPageUid,
                $mountPoint);
        }

        return $results;
    }
329475
public function anyLanguageValues($values, $attribute = null)
    {
        /** @var \yii\db\ActiveRecord $model */
        $model = new $this->owner->modelClass();
        $languageClass = $model->getRelation($model->languageRelation)->modelClass;

        $this->owner
            ->innerJoinWith($model->languageRelation, false)
            ->andWhere([$languageClass::tableName() . '.' . ($attribute ?: $model->languageValueAttribute) => $model->filterLanguageValues($values)])
            ->addGroupBy(array_map(function ($pk) use ($model) {
                return $model->tableName() . '.' . $pk;
            }, $model->primaryKey()));

        return $this->owner;
    }
83561
public function parseRow(array $values)
    {
        $values = $this->launchFilters($values);
        $entity = $this->hydration_plan->hydrate($values);

        return $this->entity_converter->cacheEntity($entity);
    }
202766
public function values(array $values) : QueryBuilder
    {
        $args    = func_get_args();
        $columns = [];
        $_values = [];

        foreach($values as $key => $value) {
            preg_match("/\(JSON\)\s*([\w]+)/i", $key, $jsonTag);

            if(
                is_array($value) ||
                is_object($value)
            ) {
                if(isset($jsonTag[0])) {
                    $key       = preg_replace('/\(JSON\)\s*([\w]+)/i', '$1', $key);
                    $_values[] = $this->getQuoted(json_encode($value));
                } else {
                    $_values[] = $this->getQuoted(serialize($value));
                }
            } else if(is_bool($value)) {
                $_values[] = ($value ? 1 : 0);
            } else if(is_null($value)) {
                $_values[] = "NULL";
            } else {
                $_values[] = $this->getQuoted($value);
            }

            $columns[] = "`". $this->sanitize($key) ."`";
        }

        $this->_query[] = "(". implode(", ", $columns) .")";
        $this->_query[] = "VALUES";
        $this->_query[] = "(". implode(", ", $_values) .")";

        return $this;
    }
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;
    }
609047
protected function detectValues($values): array
    {
        if (!is_array(reset($values))) {
            $values = [$values];
        } else {
            foreach ($values as $key => $value) {
                ksort($value);
                $values[$key] = $value;
            }
        }

        return $values;
    }
1095050
public function id(array $values)
    {
        $count = count($values);
        $ids = array_filter($values, 'ctype_digit');

        if ($count != count($ids)) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        $existing = array_filter($values, function ($user_id) {
            if ($user_id == 0) {
                return true; // 0 also valid if we check that user is logged in
            }
            $user = $this->user->get($user_id);
            return isset($user['user_id']);
        });

        if ($count != count($existing)) {
            return $this->translation->text('@name is unavailable', array(
                '@name' => $this->translation->text('User')));
        }

        return true;
    }
1126749
protected function getBindingsMergedWithValues(array $values)
    {
        $bindings = [];

        foreach ($values as $key => $value)
        {
            $bindings[$key .'_update'] = $value;
        }

        return array_merge($this->getBindings(), $bindings);
    }
1139178
protected function valPropValues(array $values)
    {
        $validPropertyValues = [];

        // Run through all property values
        /** @var ValueInterface $value */
        foreach ($values as $value) {
            $this->procPropValue($value, $validPropertyValues);
        }

        return $validPropertyValues;
    }
459401
public function mapKeysToTitles(array $values)
    {
        $map = array_flip($this->_getTitlesMap());

        $result = array();
        foreach ($values as $key => $value) {
            if (isset($map[$key])) {
                $result[$map[$key]] = $value;
            } else {
                $result[$key] = $value;
            }
        }
        // \MUtil_Echo::track($result);

        return $result;
    }
340277
public function updateTranslations(array $values)
    {
        $array = [];

        foreach ($values as $lang => $data) {
            $array['locale'] = $lang;

            foreach ($this->translatedAttributes as $key => $attribute) {
                $array[$attribute] = isset($values[$lang][$attribute]) ? $values[$lang][$attribute] : '';
            }

            $translation = $this->translations()->where('locale', $lang)->first();

            // Make sure we can translate Stapler files as well
            $staplerConfig = (array)object_get(new $this->translationModel(), 'staplerConfig', []);
            $staplerFields = array_keys($staplerConfig);
            foreach ($staplerFields as $staplerField) {
                $array = collect($array)->filter(function ($value, $key) use ($staplerField) {

                    $removable = [
                        $staplerField . '_file_name',
                        $staplerField . '_file_size',
                        $staplerField . '_content_type',
                        $staplerField . '_updated_at'
                    ];

                    if (in_array($key, $removable)) {
                        return false;
                    }

                    return true;
                })->toArray();
            }

            if (! $translation) {
                $this->translations()->create($array);
            } else {
                $translation->update($array);
            }
        }
    }