You are here

class FractionConstraint in Fraction 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Validation/Constraint/FractionConstraint.php \Drupal\fraction\Plugin\Validation\Constraint\FractionConstraint

Plugin implementation of the 'fraction_constraint'.

Plugin annotation


@Constraint(
  id = "FractionConstraint",
  label = @Translation("Fraction constraint", context = "Validation"),
)

Hierarchy

  • class \Drupal\fraction\Plugin\Validation\Constraint\FractionConstraint extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of FractionConstraint

1 file declares its use of FractionConstraint
FractionConstraintTest.php in tests/src/Kernel/Plugin/Constraints/FractionConstraintTest.php

File

src/Plugin/Validation/Constraint/FractionConstraint.php, line 15

Namespace

Drupal\fraction\Plugin\Validation\Constraint
View source
class FractionConstraint extends Constraint {

  /**
   * Constraint message if denominator is empty or zero.
   *
   * @var string
   */
  public $denominatorNotZero = 'The denominator of a fraction cannot be zero or empty.';

  /**
   * Constraint message if denominator is out of range from 1 to 2147483647.
   *
   * @var string
   */
  public $denominatorOutOfRange = 'The denominator must be between 1 and 2147483647';

  /**
   * Constraint message if numerator is out of range.
   *
   * Range spans from -9223372036854775808 to 9223372036854775807
   *
   * @var string
   */
  public $numeratorOutOfRange = 'The numerator must be between -9223372036854775808 and 9223372036854775807.';

  /**
   * Constraint message if number of decimal digits is greater than 9.
   *
   * @var string
   */
  public $maxNumberOfDecimals = 'The maximum number of digits after the decimal place is 9.';

}

Members

Namesort descending Modifiers Type Description Overrides
FractionConstraint::$denominatorNotZero public property Constraint message if denominator is empty or zero.
FractionConstraint::$denominatorOutOfRange public property Constraint message if denominator is out of range from 1 to 2147483647.
FractionConstraint::$maxNumberOfDecimals public property Constraint message if number of decimal digits is greater than 9.
FractionConstraint::$numeratorOutOfRange public property Constraint message if numerator is out of range.