/var/www/html_uk/wp-content/plugins/automatewoo/includes/Queue_Manager.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

/**
 * @class Queue_Manager
 */
class Queue_Manager {

    
/**
     * @param $code
     * @return string
     */
    
static function get_failure_message$code ) {

        
$messages = [
            
Queued_Event::F_WORKFLOW_INACTIVE => __'The workflow was deleted or deactivated.''automatewoo' ),
            
Queued_Event::F_MISSING_DATA => __'Some of the required data was not found. For example, the order could have been deleted.''automatewoo' ),
            
Queued_Event::F_FATAL_ERROR => __'A fatal error occurred while running the queued event.''automatewoo' ),
        ];

        if ( isset( 
$messages[$code] ) ) {
            return 
$messages[$code];
        }

        return 
__'Cause of queued event failure is unknown.''automatewoo' );
    }

    
/**
     * Returns the meta key that a data item is mapped to in queue meta.
     *
     * @param $data_type_id string
     * @return bool|string
     */
    
static function get_data_layer_storage_key$data_type_id ) {
        return 
'data_item_' $data_type_id;
    }


    
/**
     * @param $data_type_id
     * @param $data_item : must be validated
     * @return mixed
     */
    
static function get_data_layer_storage_value$data_type_id$data_item ) {
        
// same method as logs
        
return Logs::get_data_layer_storage_value$data_type_id$data_item );
    }

}