Version 1
[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  * @see \Drupal\workflows\WorkflowTypeInterface::decorateState()
9  *
10  * @internal
11  *   The workflow system is currently experimental and should only be leveraged
12  *   by experimental modules and development releases of contributed modules.
13  */
14 interface StateInterface {
15
16   /**
17    * Gets the state's ID.
18    *
19    * @return string
20    *   The state's ID.
21    */
22   public function id();
23
24   /**
25    * Gets the state's label.
26    *
27    * @return string
28    *   The state's label.
29    */
30   public function label();
31
32   /**
33    * Gets the state's weight.
34    *
35    * @return int
36    *   The state's weight.
37    */
38   public function weight();
39
40   /**
41    * Determines if the state can transition to the provided state ID.
42    *
43    * @param $to_state_id
44    *   The state to transition to.
45    *
46    * @return bool
47    *   TRUE if the state can transition to the provided state ID. FALSE, if not.
48    */
49   public function canTransitionTo($to_state_id);
50
51   /**
52    * Gets the Transition object for the provided state ID.
53    *
54    * @param $to_state_id
55    *   The state to transition to.
56    *
57    * @return \Drupal\workflows\TransitionInterface
58    *   The Transition object for the provided state ID.
59    *
60    * @throws \InvalidArgumentException()
61    *   Exception thrown when the provided state ID can not be transitioned to.
62    */
63   public function getTransitionTo($to_state_id);
64
65   /**
66    * Gets all the possible transition objects for the state.
67    *
68    * @return \Drupal\workflows\TransitionInterface[]
69    *   All the possible transition objects for the state.
70    */
71   public function getTransitions();
72
73 }