Code Duplication    Length = 66-66 lines in 2 locations

app/Services/Action/TaskClose.php 1 location

@@ 17-82 (lines=66) @@
14
/**
15
 * Close automatically a task.
16
 */
17
class TaskClose extends Base
18
{
19
    /**
20
     * Get automatic action description.
21
     *
22
     * @return string
23
     */
24
    public function getDescription()
25
    {
26
        return t('Close a task');
27
    }
28
29
    /**
30
     * Get the list of compatible events.
31
     *
32
     * @return array
33
     */
34
    public function getCompatibleEvents()
35
    {
36
        return [];
37
    }
38
39
    /**
40
     * Get the required parameter for the action (defined by the user).
41
     *
42
     * @return array
43
     */
44
    public function getActionRequiredParameters()
45
    {
46
        return [];
47
    }
48
49
    /**
50
     * Get the required parameter for the event.
51
     *
52
     * @return string[]
53
     */
54
    public function getEventRequiredParameters()
55
    {
56
        return ['task_id'];
57
    }
58
59
    /**
60
     * Execute the action (close the task).
61
     *
62
     * @param array $data Event data dictionary
63
     *
64
     * @return bool True if the action was executed or false when not executed
65
     */
66
    public function doAction(array $data)
67
    {
68
        return $this->taskStatusModel->close($data['task_id']);
69
    }
70
71
    /**
72
     * Check if the event data meet the action condition.
73
     *
74
     * @param array $data Event data dictionary
75
     *
76
     * @return bool
77
     */
78
    public function hasRequiredCondition(array $data)
79
    {
80
        return true;
81
    }
82
}
83

app/Services/Action/TaskOpen.php 1 location

@@ 17-82 (lines=66) @@
14
/**
15
 * Open automatically a task.
16
 */
17
class TaskOpen extends Base
18
{
19
    /**
20
     * Get automatic action description.
21
     *
22
     * @return string
23
     */
24
    public function getDescription()
25
    {
26
        return t('Open a task');
27
    }
28
29
    /**
30
     * Get the list of compatible events.
31
     *
32
     * @return array
33
     */
34
    public function getCompatibleEvents()
35
    {
36
        return [];
37
    }
38
39
    /**
40
     * Get the required parameter for the action (defined by the user).
41
     *
42
     * @return array
43
     */
44
    public function getActionRequiredParameters()
45
    {
46
        return [];
47
    }
48
49
    /**
50
     * Get the required parameter for the event.
51
     *
52
     * @return string[]
53
     */
54
    public function getEventRequiredParameters()
55
    {
56
        return ['task_id'];
57
    }
58
59
    /**
60
     * Execute the action (close the task).
61
     *
62
     * @param array $data Event data dictionary
63
     *
64
     * @return bool True if the action was executed or false when not executed
65
     */
66
    public function doAction(array $data)
67
    {
68
        return $this->taskStatusModel->open($data['task_id']);
69
    }
70
71
    /**
72
     * Check if the event data meet the action condition.
73
     *
74
     * @param array $data Event data dictionary
75
     *
76
     * @return bool
77
     */
78
    public function hasRequiredCondition(array $data)
79
    {
80
        return true;
81
    }
82
}
83