Completed
Branch GDPR/user-data-export (1838dd)
by
unknown
53:17 queued 40:13
created

AssetRegistrationException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 9
nc 2
nop 4
dl 14
loc 14
rs 9.4285
c 1
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\services\assets;
4
5
use Exception;
6
use RuntimeException;
7
8
9
/**
10
 * Class AssetRegistrationException
11
 * Thrown when a call to wp_register_script() returns false
12
 *
13
 * @package EventEspresso\core\services\assets
14
 * @author  Brent Christensen
15
 * @since   $VID:$
16
 */
17 View Code Duplication
class AssetRegistrationException extends RuntimeException
18
{
19
    /**
20
     * @param                $script_handle
21
     * @param string         $message
22
     * @param int            $code
23
     * @param Exception|null $previous
24
     */
25
    public function __construct($script_handle, $message = '', $code = 0, Exception $previous = null)
26
    {
27
        if (empty($message)) {
28
            $message = sprintf(
29
                esc_html_x(
30
                    'The "%1$s" script could not be registered with WordPress core.',
31
                    'The "script-handle" script could not be registered with WordPress core.',
32
                    'event_espresso'
33
                ),
34
                $script_handle
35
            );
36
        }
37
        parent::__construct($message, $code, $previous);
38
    }
39
}