Returns a value indicating whether languages exists.
@param string|string[] $values
@return boolean
764720
public function hasLanguageValues($values)
    {
        $tagValues = $this->getLanguageValues(true);
        foreach ($this->filterLanguageValues($values) as $value) {
            if (!in_array($value, $tagValues)) {
                return false;
            }
        }
        return true;
    }
373010
protected function decodeValues(&$values)
    {
        if (is_array($values)) {
            foreach ($values as &$value) {
                $value = $this->decodeValues($value);
            }
            return $values;
        } elseif (is_string($values)) {
            return html_entity_decode($values, ENT_COMPAT, 'UTF-8');
        }
        return $values;
    }
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;
    }
983405
public function shippingMethod(array $values)
    {
        $existing = array_filter($values, function ($method_id) {
            return (bool) $this->shipping->get($method_id);
        });

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

        return true;
    }
1226055
public function countryCode(array $values)
    {
        $existing = array_filter($values, function ($code) {
            $country = $this->country->get($code);
            return isset($country['code']);
        });

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

        return true;
    }
325492
public function detect(string $text, array $languages = null, bool $force = false)
    {
        if ($languages) {
            foreach ($languages as $k) {
                $this->checkDetectType($k);
            }
            $languages = implode('|', $languages);
        }

        $candidate_langs = $languages;
        $force = (int) $force;

        return Request::exec(self::DETECT, compact('text', 'candidate_langs', 'force'));
    }
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);
    }
972148
public function date(array $values)
    {
        if (count($values) != 1) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        $timestamp = strtotime(reset($values));

        if (empty($timestamp)) {
            $vars = array('@field' => $this->translation->text('Condition'));
            return $this->translation->text('@field has invalid value', $vars);
        }

        return true;
    }
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;
    }
1317232
private function compareAgainstSupportedLocales(array $aggregatedValues)
    {
        if (null !== $negotiatedValue = $this->exactCompareAgainstSupportedLocales($aggregatedValues)) {
            return $negotiatedValue;
        }

        if (null !== $negotiatedValue = $this->languageCompareAgainstSupportedLocales($aggregatedValues)) {
            return $negotiatedValue;
        }

        if (isset($aggregatedValues['*'])) {
            return new NegotiatedValue(reset($this->supportedLocales), $aggregatedValues['*']);
        }

        return null;
    }
731178
public function upsert(array $values)
    {
        if (empty($values)) {
            return true;
        }
        $values = $this->detectValues($values);
        $bindings = [];
        foreach ($values as $record) {
            foreach ($record as $key => $value) {
                $bindings[$key] = $value;
            }
        }

        $sql = $this->grammar->compileUpsert($this, $values);

        return $this->connection->upsert($sql, $bindings);
    }
1005786
public function has($values)
    {
        $hases = explode(',', $values);
        $model = $this->builder->getModel();
        $hases = collect($hases)->filter(function ($has) use($model) {
            if (str_contains($has, '.')) return ($model->{explode('.', $has)[0]}() instanceof Relation);
            return ($model->{$has}() instanceof Relation);
        })->toArray();
        $validator = validator([ 'values' => $hases ], [ 'values' => 'array|min:1' ]);
        return $this->builder->when(!$validator->fails(), function (Builder $query) use($hases) {
            foreach ($hases as $has) {
                $query->has($has);
            }
        });
    }
284491
public function evaluate($values)
    {
        // Only validate if the source is set to 'list'
        $sourceElement = $this->getOption('sourceElement');
        $sourceElementValue = $sourceElement->getEvaluatedValue();
        if ($sourceElementValue !== 'list') {
            return true;
        }

        $this->invalidValues = [];
        $values = trim(str_replace("\r", '', $values));

        if (!$values) {
            $this->setMessage('Please add at least one domain or directive.');
            return false;
        }

        $sources = explode("\n", $values);

        foreach ($sources as $key => $source) {
            if ($source === '') {
                unset($sources[$key]);
            }

            if (in_array($source, self::DIRECTIVES, true)) {
                if ($this->isValidDirective($source) === false) {
                    $this->invalidValues['domain'][] = $source;
                }
                $sources[$key] = $this->getNormalizedDirective($source);

                continue;
            }

            if ($this->isValidDomain($source) === false) {
                $this->invalidValues['domain'][] = $source;
            }
        }

        $isValid = empty($this->invalidValues);
        if (!$isValid) {
            $this->setMessage($this->getErrorMessage());
        }

        return $isValid;
    }
1332599
public function evaluate($values)
    {
        $returnValue = PasswordConstraintsService::singleton()->validate($values);

        if( !$returnValue && !$this->hasOption('message') ){
            $this->setMessage(implode( ', ', PasswordConstraintsService::singleton()->getErrors()));
        }

        return (bool) $returnValue;
    }
988235
public function values($values = null)
    {
        deprecationWarning(
            'ValuesExpression::values() is deprecated. ' .
            'Use ValuesExpression::setValues()/getValues() instead.'
        );
        if ($values !== null) {
            return $this->setValues($values);
        }

        return $this->getValues();
    }
619885
private static function hasDuplicates(array $values): bool
    {
        $values = array_diff($values, [Grid::EMPTY_VALUE]);

        return count(array_count_values($values)) !== count($values);
    }
872027
public function roleId(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')));
        }

        $exists = array_filter($values, function ($role_id) {

            if ($role_id == 0) {
                return true;
            }

            $role = $this->role->get($role_id);
            return isset($role['role_id']);
        });

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

        return true;
    }