/var/www/html_uk/wp-content/plugins/automatewoo/includes/Jobs/JobException.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
<?php

namespace AutomateWoo\Jobs;

use 
AutomateWoo\Exceptions\Exception as ExceptionInterface;
use 
RuntimeException;

defined'ABSPATH' ) || exit;

/**
 * JobException class.
 *
 * @since 5.1.0
 */
class JobException extends RuntimeException implements ExceptionInterface {

    
/**
     * Create a new exception when a job does not exist.
     *
     * @param string $name
     *
     * @return static
     */
    
public static function job_does_not_existstring $name ): JobException {
        return new static( 
sprintf'The job named "%s" does not exist.'$name ) );
    }

    
/**
     * Create a new exception instance for when a job item is not found.
     *
     * @return static
     */
    
public static function item_not_found(): JobException {
        return new static( 
__'Job item not found.''automatewoo' ) );
    }

    
/**
     * Create a new exception instance for when a job is stopped due to a high failure rate.
     *
     * @param string $job_name
     *
     * @return static
     */
    
public static function stopped_due_to_high_failure_ratestring $job_name ): JobException {
        return new static(
            
sprintf(
                
/* translators: Job name. */
                
__'The "%s" job was stopped because it\'s failure rate is above the allowed threshold.''automatewoo' ),
                
$job_name
            
)
        );
    }
}