Version 1
[yaffs-website] / web / core / modules / workflows / tests / modules / workflow_type_test / src / DecoratedTransition.php
1 <?php
2
3 namespace Drupal\workflow_type_test;
4
5 use Drupal\workflows\TransitionInterface;
6
7 /**
8  * A value object representing a workflow transition.
9  */
10 class DecoratedTransition implements TransitionInterface {
11
12   /**
13    * The vanilla transition object from the Workflow module.
14    *
15    * @var \Drupal\workflows\TransitionInterface
16    */
17   protected $transition;
18
19   /**
20    * Extra information added to transition.
21    *
22    * @var string
23    */
24   protected $extra;
25
26   /**
27    * DecoratedTransition constructor.
28    *
29    * @param \Drupal\workflows\TransitionInterface $transition
30    *   The vanilla transition object from the Workflow module.
31    * @param string $extra
32    *   (optional) Extra information stored on the transition. Defaults to ''.
33    */
34   public function __construct(TransitionInterface $transition, $extra = '') {
35     $this->transition = $transition;
36     $this->extra = $extra;
37   }
38
39   /**
40    * Gets the extra information stored on the transition.
41    *
42    * @return string
43    */
44   public function getExtra() {
45     return $this->extra;
46   }
47
48   /**
49    * {@inheritdoc}
50    */
51   public function id() {
52     return $this->transition->id();
53   }
54
55   /**
56    * {@inheritdoc}
57    */
58   public function label() {
59     return $this->transition->label();
60   }
61
62   /**
63    * {@inheritdoc}
64    */
65   public function from() {
66     return $this->transition->from();
67   }
68
69   /**
70    * {@inheritdoc}
71    */
72   public function to() {
73     return $this->transition->to();
74   }
75
76   /**
77    * {@inheritdoc}
78    */
79   public function weight() {
80     return $this->transition->weight();
81   }
82
83 }