annotate core/modules/workflows/src/StateInterface.php @ 19:fa3358dc1485 tip

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