Code Duplication    Length = 18-27 lines in 8 locations

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/assets/AssetRegistrationException.php 1 location

@@ 17-39 (lines=23) @@
14
 * @author  Brent Christensen
15
 * @since   4.9.62.p
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
}

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/collections/DuplicateCollectionIdentifierException.php 1 location

@@ 16-40 (lines=25) @@
13
 * @author  Brent Christensen
14
 * @since   4.9.62.p
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   4.9.62.p
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/InvalidAliasException.php 1 location

@@ 16-42 (lines=27) @@
13
 * @author        Brent Christensen
14
 * @since         4.9.0
15
 */
16
class InvalidAliasException extends DomainException
17
{
18
19
    /**
20
     * InvalidClassException constructor.
21
     *
22
     * @param string    $fqcn
23
     * @param string    $alias
24
     * @param string    $message
25
     * @param int       $code
26
     * @param Exception $previous
27
     */
28
    public function __construct($fqcn, $alias, $message = '', $code = 0, Exception $previous = null)
29
    {
30
        if (empty($message)) {
31
            $message = sprintf(
32
                __(
33
                    '"%1$s" can not be used as an alias because the "%2$s"  class does not extend or implement it.',
34
                    'event_espresso'
35
                ),
36
                $alias,
37
                $fqcn
38
            );
39
        }
40
        parent::__construct($message, $code, $previous);
41
    }
42
}
43

core/services/collections/CollectionDetailsException.php 1 location

@@ 16-40 (lines=25) @@
13
 * @author  Brent Christensen
14
 * @since   4.9.62.p
15
 */
16
class CollectionDetailsException extends RuntimeException
17
{
18
19
    /**
20
     * DuplicateCollectionIdentifierException constructor.
21
     *
22
     * @param Exception $previous
23
     * @param string    $message
24
     * @param int       $code
25
     */
26
    public function __construct(Exception $previous, $message = '', $code = 0)
27
    {
28
        if (empty($message)) {
29
            $message = sprintf(
30
                __(
31
                    'The following error occurred during the collection details generation: %1$s %2$s',
32
                    'event_espresso'
33
                ),
34
                '<br />',
35
                $previous->getMessage()
36
            );
37
        }
38
        parent::__construct($message, $code, $previous);
39
    }
40
}
41

core/services/collections/CollectionLoaderException.php 1 location

@@ 16-40 (lines=25) @@
13
 * @author  Brent Christensen
14
 * @since   4.9.62.p
15
 */
16
class CollectionLoaderException extends RuntimeException
17
{
18
19
    /**
20
     * DuplicateCollectionIdentifierException constructor.
21
     *
22
     * @param Exception $previous
23
     * @param string    $message
24
     * @param int       $code
25
     */
26
    public function __construct(Exception $previous, $message = '', $code = 0)
27
    {
28
        if (empty($message)) {
29
            $message = sprintf(
30
                __(
31
                    'The following error occurred during the creation and/or loading of this collection: %1$s %2$s',
32
                    'event_espresso'
33
                ),
34
                '<br />',
35
                $previous->getMessage()
36
            );
37
        }
38
        parent::__construct($message, $code, $previous);
39
    }
40
}
41