Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
33.33% covered (danger)
33.33%
2 / 6
33.33% covered (danger)
33.33%
2 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
Contact_Updated
33.33% covered (danger)
33.33%
2 / 6
33.33% covered (danger)
33.33%
2 / 6
16.67
0.00% covered (danger)
0.00%
0 / 1
 get_slug
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_title
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_description
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_category
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 get_data_type
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 listen_to_event
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Jetpack CRM Automation Contact_Updated trigger.
4 *
5 * @package automattic/jetpack-crm
6 * @since 6.2.0
7 */
8
9namespace Automattic\Jetpack\CRM\Automation\Triggers;
10
11use Automattic\Jetpack\CRM\Automation\Automation_Workflow;
12use Automattic\Jetpack\CRM\Automation\Base_Trigger;
13use Automattic\Jetpack\CRM\Automation\Data_Types\Contact_Data;
14
15/**
16 * Adds the Contact_Updated class.
17 *
18 * @since 6.2.0
19 */
20class Contact_Updated extends Base_Trigger {
21
22    /**
23     * The Automation workflow object.
24     *
25     * @since 6.2.0
26     * @var Automation_Workflow
27     */
28    protected $workflow;
29
30    /**
31     * Get the slug name of the trigger.
32     *
33     * @since 6.2.0
34     *
35     * @return string The slug name of the trigger.
36     */
37    public static function get_slug(): string {
38        return 'jpcrm/contact_updated';
39    }
40
41    /**
42     * Get the title of the trigger.
43     *
44     * @since 6.2.0
45     *
46     * @return string|null The title of the trigger.
47     */
48    public static function get_title(): ?string {
49        return __( 'Contact Updated', 'zero-bs-crm' );
50    }
51
52    /**
53     * Get the description of the trigger.
54     *
55     * @since 6.2.0
56     *
57     * @return string|null The description of the trigger.
58     */
59    public static function get_description(): ?string {
60        return __( 'Triggered when a CRM contact is updated', 'zero-bs-crm' );
61    }
62
63    /**
64     * Get the category of the trigger.
65     *
66     * @since 6.2.0
67     *
68     * @return string|null The category of the trigger.
69     */
70    public static function get_category(): ?string {
71        return __( 'Contact', 'zero-bs-crm' );
72    }
73
74    /**
75     * Get the date type.
76     *
77     * @return string The type of the step
78     */
79    public static function get_data_type(): string {
80        return Contact_Data::class;
81    }
82
83    /**
84     * Listen to the desired event.
85     *
86     * @since 6.2.0
87     *
88     * @return void
89     */
90    protected function listen_to_event(): void {
91        $this->listen_to_wp_action( 'jpcrm_contact_updated' );
92    }
93}