StringEqualsConcatenatedValuesConstraint.php

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/StringEqualsConcatenatedValuesConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Core\Validation\Plugin\Validation\Constraint;

use Drupal\Core\Validation\Attribute\Constraint;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Checks a string consists of specific values found in the mapping.
 */
class StringEqualsConcatenatedValuesConstraint extends SymfonyConstraint {
  
  /**
   * The error message if the string does not match.
   *
   * @var string
   */
  public string $message = "Expected '@expected_string', not '@value'. Format: '@expected_format'.";
  
  /**
   * The separator separating the values.
   *
   * @var string
   */
  public string $separator;
  
  /**
   * Reserved characters — if any — that are to be substituted in each value.
   *
   * @var string[]
   */
  public array $reservedCharacters = [];
  
  /**
   * Any reserved characters that will be substituted by this character.
   *
   * @var ?string
   */
  public ?string $reservedCharactersSubstitute;
  
  /**
   * The mappings to values to concatenate together.
   *
   * @var array
   */
  public array $values;
  
  /**
   * {@inheritdoc}
   */
  public function getRequiredOptions() : array {
    return [
      'separator',
      'values',
    ];
  }

}

Classes

Title Deprecated Summary
StringEqualsConcatenatedValuesConstraint Checks a string consists of specific values found in the mapping.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.