Code Duplication    Length = 18-26 lines in 5 locations

core/services/collections/DuplicateCollectionIdentifierException.php 1 location

@@ 16-40 (lines=25) @@
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16
class DuplicateCollectionIdentifierException extends OutOfRangeException
17
{
18
19
    /**
20
     * DuplicateCollectionIdentifierException constructor.
21
     *
22
     * @param                $identifier
23
     * @param string         $message
24
     * @param int            $code
25
     * @param Exception|null $previous
26
     */
27
    public function __construct($identifier, $message = '', $code = 0, Exception $previous = null)
28
    {
29
        if (empty($message)) {
30
            $message = sprintf(
31
                __(
32
                    'The supplied identifier "%1$s" already exists within this collection.',
33
                    'event_espresso'
34
                ),
35
                $identifier
36
            );
37
        }
38
        parent::__construct($message, $code, $previous);
39
    }
40
}
41

core/services/collections/InvalidCollectionIdentifierException.php 1 location

@@ 16-41 (lines=26) @@
13
 * @author  Brent Christensen
14
 * @since   $VID:$
15
 */
16
class InvalidCollectionIdentifierException extends OutOfBoundsException
17
{
18
19
    /**
20
     * InvalidCollectionIdentifierException constructor.
21
     *
22
     * @param                $identifier
23
     * @param string         $message
24
     * @param int            $code
25
     * @param Exception|null $previous
26
     */
27
    public function __construct($identifier, $message = '', $code = 0, Exception $previous = null)
28
    {
29
        if (empty($message)) {
30
            $message = sprintf(
31
                __(
32
                    'The supplied identifier "%1$s" does not exist within this collection. 
33
                    You may need to delay adding this asset until the required dependency has been added.',
34
                    'event_espresso'
35
                ),
36
                $identifier
37
            );
38
        }
39
        parent::__construct($message, $code, $previous);
40
    }
41
}
42

core/exceptions/InvalidSessionDataException.php 1 location

@@ 12-29 (lines=18) @@
9
 * @package       Event Espresso
10
 * @author        Brent Christensen
11
 */
12
class InvalidSessionDataException extends \Exception
13
{
14
15
    /**
16
     * InvalidInterfaceException constructor.
17
     *
18
     * @param string     $message
19
     * @param int        $code
20
     * @param \Exception $previous
21
     */
22
    public function __construct($message = '', $code = 0, \Exception $previous = null)
23
    {
24
        if (empty($message)) {
25
            $message = esc_html__('The session data is either missing or invalid.', 'event_espresso');
26
        }
27
        parent::__construct($message, $code, $previous);
28
    }
29
}
30

core/services/container/exceptions/ServiceNotFoundException.php 1 location

@@ 12-37 (lines=26) @@
9
 * @package       Event Espresso
10
 * @author        Brent Christensen
11
 */
12
class ServiceNotFoundException extends \RuntimeException
13
{
14
15
    /**
16
     * ServiceNotFoundException constructor
17
     *
18
     * @param string     $service_name the name of the requested service
19
     * @param string     $message
20
     * @param int        $code
21
     * @param \Exception $previous
22
     */
23
    public function __construct(
24
        $service_name,
25
        $message = '',
26
        $code = 0,
27
        \Exception $previous = null
28
    ) {
29
        if (empty($message)) {
30
            $message = sprintf(
31
                __('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
32
                $service_name
33
            );
34
        }
35
        parent::__construct($message, $code, $previous);
36
    }
37
}
38

core/services/assets/AssetRegistrationException.php 1 location

@@ 17-39 (lines=23) @@
14
 * @author  Brent Christensen
15
 * @since   $VID:$
16
 */
17
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
}