VariantConditionInterface.php 848 Bytes
Newer Older
1
2
3
4
<?php

namespace Drupal\typed_entity\WrappedEntityVariants;

e0ipso's avatar
e0ipso committed
5
6
7
/**
 * Interface for the variant conditions.
 */
8
9
interface VariantConditionInterface {

e0ipso's avatar
e0ipso committed
10
11
12
13
14
15
  /**
   * Checks if the condition is negated.
   *
   * @return bool
   *   TRUE if the condition is negated.
   */
16
  public function isNegated(): bool;
e0ipso's avatar
e0ipso committed
17
18
19
20
21
22
23
24
25

  /**
   * Evaluates the condition.
   *
   * @return bool
   *   TRUE if the condition is fulfilled.
   *
   * @throws \Drupal\typed_entity\InvalidValueException
   */
26
  public function evaluate(): bool;
e0ipso's avatar
e0ipso committed
27
28
29
30
31
32
33

  /**
   * A human readable summary of the condition. Used for interface purposes.
   *
   * @return string
   *   The summary.
   */
34
  public function summary(): string;
e0ipso's avatar
e0ipso committed
35
36
37
38
39
40
41

  /**
   * Gets the FQN of the class for the wrapped entity variant.
   *
   * @return string
   *   The variant class.
   */
42
43
44
  public function variant(): string;

}