Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
CRAP | |
0.00% |
0 / 1 |
| New_Contact | |
0.00% |
0 / 7 |
|
0.00% |
0 / 6 |
42 | |
0.00% |
0 / 1 |
| get_slug | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_title | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_description | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_data_type | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_category | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| execute | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jetpack CRM Automation New_Contact action. |
| 4 | * |
| 5 | * @package automattic/jetpack-crm |
| 6 | * @since 6.2.0 |
| 7 | */ |
| 8 | |
| 9 | namespace Automattic\Jetpack\CRM\Automation\Actions; |
| 10 | |
| 11 | use Automattic\Jetpack\CRM\Automation\Base_Action; |
| 12 | use Automattic\Jetpack\CRM\Automation\Data_Types\Contact_Data; |
| 13 | use Automattic\Jetpack\CRM\Automation\Data_Types\Data_Type; |
| 14 | |
| 15 | /** |
| 16 | * Adds the New_Contact class. |
| 17 | * |
| 18 | * @since 6.2.0 |
| 19 | */ |
| 20 | class New_Contact extends Base_Action { |
| 21 | |
| 22 | /** |
| 23 | * Get the slug name of the step. |
| 24 | * |
| 25 | * @since 6.2.0 |
| 26 | * |
| 27 | * @return string The slug name of the step. |
| 28 | */ |
| 29 | public static function get_slug(): string { |
| 30 | return 'jpcrm/new_contact'; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Get the title of the step. |
| 35 | * |
| 36 | * @since 6.2.0 |
| 37 | * |
| 38 | * @return string|null The title of the step. |
| 39 | */ |
| 40 | public static function get_title(): ?string { |
| 41 | return 'New Contact Action'; |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Get the description of the step. |
| 46 | * |
| 47 | * @since 6.2.0 |
| 48 | * |
| 49 | * @return string|null The description of the step. |
| 50 | */ |
| 51 | public static function get_description(): ?string { |
| 52 | return 'Action to add the new contact'; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get the data type. |
| 57 | * |
| 58 | * @since 6.2.0 |
| 59 | * |
| 60 | * @return string The type of the step. |
| 61 | */ |
| 62 | public static function get_data_type(): string { |
| 63 | return Contact_Data::class; |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Get the category of the step. |
| 68 | * |
| 69 | * @since 6.2.0 |
| 70 | * |
| 71 | * @return string|null The category of the step. |
| 72 | */ |
| 73 | public static function get_category(): ?string { |
| 74 | return __( 'Contact', 'zero-bs-crm' ); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Add the new contact to the DAL. |
| 79 | * |
| 80 | * @since 6.2.0 |
| 81 | * |
| 82 | * @param Data_Type $data Data passed from the trigger. |
| 83 | */ |
| 84 | protected function execute( Data_Type $data ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 85 | global $zbs; |
| 86 | |
| 87 | $zbs->DAL->contacts->addUpdateContact( $this->attributes ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase |
| 88 | } |
| 89 | } |