Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2/**
3 * Interface to define Step in an automation workflow.
4 *
5 * @package automattic/jetpack-crm
6 * @since 6.2.0
7 */
8
9namespace Automattic\Jetpack\CRM\Automation;
10
11/**
12 * Interface Step.
13 *
14 * @since 6.2.0
15 */
16interface Step {
17
18    /**
19     * Get the next step.
20     *
21     * @since 6.2.0
22     *
23     * @return int|string|null The next linked step.
24     */
25    public function get_next_step_id();
26
27    /**
28     * Get the next step if the current one is successful.
29     *
30     * @since 6.2.0
31     *
32     * @return int|string|null The next linked step id.
33     */
34    public function get_next_step_true();
35
36    /**
37     * Set the next step if the current one is successful.
38     *
39     * @since 6.2.0
40     *
41     * @param string|int|null $step_id The next linked step id.
42     * @return void
43     */
44    public function set_next_step_true( $step_id ): void;
45
46    /**
47     * Get the next step if the current one is falsy.
48     *
49     * @since 6.2.0
50     *
51     * @return int|string|null The next linked step id.
52     */
53    public function get_next_step_false();
54
55    /**
56     * Set the next step if the current one is falsy.
57     *
58     * @since 6.2.0
59     *
60     * @param string|int|null $step_id The next linked step id.
61     * @return void
62     */
63    public function set_next_step_false( $step_id ): void;
64
65    /**
66     * Get the step attribute definitions.
67     *
68     * @since 6.2.0
69     *
70     * @return Attribute_Definition[] The attribute definitions of the step.
71     */
72    public function get_attribute_definitions(): ?array;
73
74    /**
75     * Get attribute value.
76     *
77     * @since 6.2.0
78     *
79     * @param string $attribute The attribute to get.
80     * @param mixed  $default The default value to return if the attribute is not set.
81     * @return mixed The attribute value.
82     */
83    public function get_attribute( string $attribute, $default = null );
84
85    /**
86     * Set attribute value.
87     *
88     * @since 6.2.0
89     *
90     * @param string $attribute The attribute key.
91     * @param mixed  $value The default value.
92     * @return void
93     */
94    public function set_attribute( string $attribute, $value );
95
96    /**
97     * Set the step attribute definitions.
98     *
99     * @since 6.2.0
100     *
101     * @param Attribute_Definition[] $attribute_definitions Set the attribute definitions.
102     */
103    public function set_attribute_definitions( array $attribute_definitions );
104
105    /**
106     * Get the attributes of the step.
107     *
108     * @since 6.2.0
109     *
110     * @return array The attributes of the step.
111     */
112    public function get_attributes(): ?array;
113
114    /**
115     * Get the attributes of the step.
116     *
117     * @since 6.2.0
118     *
119     * @param array $attributes Set attributes to this step.
120     */
121    public function set_attributes( array $attributes );
122
123    /**
124     * Get the slug name of the step.
125     *
126     * @since 6.2.0
127     *
128     * @return string The slug name of the step.
129     */
130    public static function get_slug(): string;
131
132    /**
133     * Get the title of the step.
134     *
135     * @since 6.2.0
136     *
137     * @return string|null The title of the step.
138     */
139    public static function get_title(): ?string;
140
141    /**
142     * Get the description of the step.
143     *
144     * @since 6.2.0
145     *
146     * @return string|null The description of the step.
147     */
148    public static function get_description(): ?string;
149
150    /**
151     * Get the data type expected by the step.
152     *
153     * @since 6.2.0
154     *
155     * @return string|null The data type expected by the step.
156     */
157    public static function get_data_type(): string;
158
159    /**
160     * Get the category of the step.
161     *
162     * @since 6.2.0
163     *
164     * @return string|null The category of the step.
165     */
166    public static function get_category(): ?string;
167
168    /**
169     * Get the step as an array.
170     *
171     * The main use-case to get the step as an array is to prepare
172     * the items for an API response.
173     *
174     * @since 6.2.0
175     *
176     * @return array The step as an array.
177     */
178    public function to_array(): array;
179}