Licitator 1.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.4 KiB

5 years ago
  1. <?php
  2. namespace Zitec\RuleEngineBundle\Conditions;
  3. /**
  4. * Interface ConditionInterface
  5. */
  6. interface ConditionInterface
  7. {
  8. /**
  9. * Returns the machine name for this condition,
  10. * that will be used in the generated expression to identify the corresponding parameter.
  11. *
  12. * @return string
  13. */
  14. public function getName(): string;
  15. /**
  16. * Returns the human readable name of this condition/parameter.
  17. *
  18. * @return string
  19. */
  20. public function getLabel(): string;
  21. /**
  22. * Returns the definitions for the property-operator pairs that this specific condition implementation supports.
  23. *
  24. * @return array
  25. */
  26. public function getDefinitions(): array;
  27. /**
  28. * Returns the ExpressionLanguage string for the given operator and value.
  29. *
  30. * @param string $parameterName
  31. * @param string $operator
  32. * @param mixed $value
  33. * @return string
  34. */
  35. public function getExpression(string $parameterName, string $operator, $value): string;
  36. /**
  37. * @param string $operator
  38. * @param $value
  39. * @return string
  40. */
  41. public function getDisplayValue(string $operator, $value): string;
  42. /**
  43. * Validates the parameter value before expression evaluation, to allow better exception throwing.
  44. *
  45. * @param mixed $value
  46. * @return bool
  47. */
  48. public function validateParameterValue($value): bool;
  49. }