Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. UniqueValidator.php

function UniqueValidator::reduceElementKeys

1 call to UniqueValidator::reduceElementKeys()
UniqueValidator::validate in vendor/symfony/validator/Constraints/UniqueValidator.php
Checks if the passed value is valid.

File

vendor/symfony/validator/Constraints/UniqueValidator.php, line 67

Class

UniqueValidator
@author Yevgeniy Zholkevskiy <zhenya.zholkevskiy@gmail.com>

Namespace

Symfony\Component\Validator\Constraints

Code

private function reduceElementKeys(array $fields, array $element) : array {
    $output = [];
    foreach ($fields as $field) {
        if (!\is_string($field)) {
            throw new UnexpectedTypeException($field, 'string');
        }
        if (\array_key_exists($field, $element)) {
            $output[$field] = $element[$field];
        }
    }
    return $output;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal