/var/www/html_uk/wp-content/plugins/automatewoo/includes/Exceptions/InvalidPreviewData.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
52
53
54
55
<?php

namespace AutomateWoo\Exceptions;

use 
InvalidArgumentException;

defined'ABSPATH' ) || exit;

/**
 * InvalidPreviewData exception class.
 *
 * @since   4.9.2
 * @package AutomateWoo\Exceptions
 */
class InvalidPreviewData extends InvalidArgumentException implements UserFacingException {

    
/**
     * Creates a new instance of the exception when an action can't be previewed.
     *
     * @return static
     */
    
public static function invalid_action() {
        return new static( 
__'This action can not be previewed.''automatewoo' ) );
    }

    
/**
     * Creates a new instance of the exception with a generic message.
     *
     * @return static
     */
    
public static function generic() {
        return new static( 
__'There was an error generating the preview.''automatewoo' ) );
    }

    
/**
     * Creates a new instance of the exception when a valid order isn't found.
     *
     * @return static
     */
    
public static function order_not_found() {
        return 
self::data_item_needed'order' );
    }

    
/**
     * Get an exception for when a preview data item was not found.
     *
     * @param string $data_type The type of data that is needed.
     *
     * @return static
     */
    
public static function data_item_neededstring $data_type ) {
        
/* translators: Data type. */
        
return new static( sprintf__'A valid "%s" must exist to generate the preview.''automatewoo' ), $data_type ) );
    }
}