Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / workflows / src / StateInterface.php
1 <?php
2
3 namespace Drupal\workflows;
4
5 /**
6  * An interface for state value objects.
7  *
8  * @internal
9  *   The StateInterface should only be used by Workflows and Content Moderation.
10  * @todo Revisit the need for this in https://www.drupal.org/node/2902309.
11  */
12 interface StateInterface {
13
14   /**
15    * The key of the state plugin form.
16    */
17   const PLUGIN_FORM_KEY = 'state';
18
19   /**
20    * Gets the state's ID.
21    *
22    * @return string
23    *   The state's ID.
24    */
25   public function id();
26
27   /**
28    * Gets the state's label.
29    *
30    * @return string
31    *   The state's label.
32    */
33   public function label();
34
35   /**
36    * Gets the state's weight.
37    *
38    * @return int
39    *   The state's weight.
40    */
41   public function weight();
42
43   /**
44    * Determines if the state can transition to the provided state ID.
45    *
46    * @param $to_state_id
47    *   The state to transition to.
48    *
49    * @return bool
50    *   TRUE if the state can transition to the provided state ID. FALSE, if not.
51    */
52   public function canTransitionTo($to_state_id);
53
54   /**
55    * Gets the Transition object for the provided state ID.
56    *
57    * @param $to_state_id
58    *   The state to transition to.
59    *
60    * @return \Drupal\workflows\TransitionInterface
61    *   The Transition object for the provided state ID.
62    *
63    * @throws \InvalidArgumentException()
64    *   Exception thrown when the provided state ID can not be transitioned to.
65    */
66   public function getTransitionTo($to_state_id);
67
68   /**
69    * Gets all the possible transition objects for the state.
70    *
71    * @return \Drupal\workflows\TransitionInterface[]
72    *   All the possible transition objects for the state.
73    */
74   public function getTransitions();
75
76 }