Code Duplication    Length = 18-29 lines in 16 locations

core/exceptions/EntityConstructionException.php 1 location

@@ 19-43 (lines=25) @@
16
 * @author        Brent Christensen
17
 * @since         $VID:$
18
 */
19
class EntityConstructionException extends \DomainException {
20
21
22
	/**
23
	 * EntityConstructionException constructor
24
	 *
25
	 * @param string $entity_class class name of the entity being constructed
26
	 * @param string $message
27
	 * @param int $code
28
	 * @param \Exception $previous
29
	 */
30
	public function __construct( $entity_class, $message = '', $code = 0, \Exception $previous = null ) {
31
		if ( empty( $message ) ) {
32
			$message = sprintf(
33
				__(
34
					'The "%1$s" entity could not be instantiated for an unknown reason',
35
					'event_espresso'
36
				),
37
				$entity_class
38
			);
39
		}
40
		parent::__construct( $message, $code, $previous );
41
	}
42
43
}
44
// End of file EntityConstructionException.php
45
// Location: /EntityConstructionException.php

core/exceptions/EntityNotFoundException.php 1 location

@@ 19-46 (lines=28) @@
16
 * @author        Brent Christensen
17
 * @since         4.9.0
18
 */
19
class EntityNotFoundException extends \UnexpectedValueException {
20
21
22
	/**
23
	 * EntityNotFoundException constructor
24
	 *
25
	 * @param string     $identifier_type the name of the identifier used (ie: ID, Name, etc)
26
	 * @param string     $identifier      the actual data value used to retrieve the entity
27
	 * @param string     $message
28
	 * @param int        $code
29
	 * @param \Exception $previous
30
	 */
31
	public function __construct( $identifier_type, $identifier, $message = '', $code = 0, \Exception $previous = null ) {
32
		if ( empty( $message ) ) {
33
			$message = sprintf(
34
				__(
35
					'The requested entity with %1$s="%2$s" was not found.',
36
					'event_espresso'
37
				),
38
				$identifier_type,
39
				$identifier
40
			);
41
		}
42
		parent::__construct( $message, $code, $previous );
43
	}
44
45
46
}
47
// End of file EntityNotFoundException.php
48
// Location: /EntityNotFoundException.php

core/exceptions/InvalidClassException.php 1 location

@@ 18-38 (lines=21) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class InvalidClassException extends \DomainException {
19
20
	/**
21
	 * InvalidClassException constructor.
22
	 *
23
	 * @param string     $class_name
24
	 * @param string     $message
25
	 * @param int        $code
26
	 * @param \Exception $previous
27
	 */
28
	public function __construct( $class_name, $message = '', $code = 0, \Exception $previous = null ) {
29
		if ( empty( $message ) ) {
30
			$message = sprintf(
31
				__( 'The "%1$s" Class is either missing or invalid.', 'event_espresso' ),
32
				$class_name
33
			);
34
		}
35
		parent::__construct( $message, $code, $previous );
36
	}
37
38
}
39
// End of file InvalidClassException.php
40
// Location: core/exceptions/InvalidClassException.php

core/exceptions/InvalidFilePathException.php 1 location

@@ 18-43 (lines=26) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class InvalidFilePathException extends \InvalidArgumentException {
19
20
	/**
21
	 * InvalidClassException constructor.
22
	 *
23
	 * @param string     $file_path
24
	 * @param string     $message
25
	 * @param int        $code
26
	 * @param \Exception $previous
27
	 */
28
	public function __construct( $file_path, $message = '', $code = 0, \Exception $previous = null ) {
29
		if ( empty( $message ) ) {
30
			$message = sprintf(
31
				__(
32
					'The "%1$s" file is either missing or could not be read due to permissions. Please ensure that the following path is correct and verify that the file permissions are correct:%2$s %3$s',
33
					'event_espresso'
34
				),
35
				basename( $file_path ),
36
				'<br />',
37
				$file_path
38
			);
39
		}
40
		parent::__construct( $message, $code, $previous );
41
	}
42
43
}
44
// End of file InvalidFilePathException.php
45
// Location: core/exceptions/InvalidFilePathException.php

core/exceptions/InvalidFormSubmissionException.php 1 location

@@ 18-42 (lines=25) @@
15
 * @author        Brent Christensen
16
 * @since         $VID:$
17
 */
18
class InvalidFormSubmissionException extends \OutOfBoundsException {
19
20
21
	/**
22
	 * InvalidFormSubmissionException constructor
23
	 *
24
	 * @param string     $form_name
25
	 * @param string     $message
26
	 * @param int        $code
27
	 * @param \Exception $previous
28
	 */
29
	public function __construct( $form_name, $message = '', $code = 0, \Exception $previous = null ) {
30
		if ( empty( $message ) ) {
31
			$message = sprintf(
32
				__(
33
					'The data for the "%1$s" form, is either missing or was not submitted properly.',
34
					'event_espresso'
35
				),
36
				$form_name
37
			);
38
		}
39
		parent::__construct( $message, $code, $previous );
40
	}
41
42
}
43
// End of file InvalidFormSubmissionException.php
44
// Location: /InvalidFormSubmissionException.php

core/exceptions/InvalidIdentifierException.php 1 location

@@ 15-40 (lines=26) @@
12
 * @author        Brent Christensen
13
 * @since         4.9.0
14
 */
15
 class InvalidIdentifierException extends \InvalidArgumentException {
16
17
	 /**
18
	  * InvalidIdentifierException constructor.
19
	  *
20
	  * @param string     $actual   the identifier that was supplied
21
	  * @param string     $expected example of an acceptable identifier
22
	  * @param string     $message
23
	  * @param int        $code
24
	  * @param \Exception $previous
25
	  */
26
	 public function __construct( $actual, $expected, $message = '', $code = 0, \Exception $previous = null ) {
27
		 if ( empty( $message ) ) {
28
			 $message = sprintf(
29
				 __(
30
					 'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.',
31
					 'event_espresso'
32
				 ),
33
				 $actual,
34
				 $expected
35
			 );
36
		 }
37
		 parent::__construct( $message, $code, $previous );
38
	 }
39
40
 }
41
// End of file InvalidIdentifierException.php
42
// Location: /InvalidIdentifierException.php

core/exceptions/InvalidInterfaceException.php 1 location

@@ 19-39 (lines=21) @@
16
 * @author        Brent Christensen
17
 * @since         4.9.0
18
 */
19
class InvalidInterfaceException extends \DomainException {
20
21
	/**
22
	 * InvalidInterfaceException constructor.
23
	 *
24
	 * @param string     $interface_name
25
	 * @param string     $message
26
	 * @param int        $code
27
	 * @param \Exception $previous
28
	 */
29
	public function __construct( $interface_name, $message = '', $code = 0, \Exception $previous = null ) {
30
		if ( empty( $message ) ) {
31
			$message = sprintf(
32
				__( 'The "%1$s" Interface is either missing or invalid.', 'event_espresso' ),
33
				$interface_name
34
			);
35
		}
36
		parent::__construct( $message, $code, $previous );
37
	}
38
39
}
40
// End of file InvalidInterfaceException.php
41
// Location: core/exceptions/InvalidInterfaceException.php

core/libraries/form_sections/form_handlers/InvalidFormHandlerException.php 1 location

@@ 18-42 (lines=25) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class InvalidFormHandlerException extends \UnexpectedValueException
19
{
20
21
	/**
22
	 * InvalidFormHandlerException constructor.
23
	 *
24
	 * @param string $actual the FormHandler object that was received
25
	 * @param string     $message
26
	 * @param int        $code
27
	 * @param \Exception $previous
28
	 */
29
	public function __construct( $actual, $message = '', $code = 0, \Exception $previous = null ) {
30
		if ( empty( $message ) ) {
31
			$message = sprintf(
32
				__(
33
					'A valid Form Handler was expected but instead "%1$s" was received.',
34
					'event_espresso'
35
				),
36
				$actual
37
			);
38
		}
39
		parent::__construct( $message, $code, $previous );
40
	}
41
42
}
43
// End of file InvalidFormHandlerException.php
44
// Location: /InvalidFormHandlerException.php

core/services/commands/CommandHandlerNotFoundException.php 1 location

@@ 18-38 (lines=21) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class CommandHandlerNotFoundException extends \OutOfBoundsException
19
{
20
21
	/**
22
	 * @access public
23
	 * @param  string     $command_handler_name
24
	 * @param  string     $message
25
	 * @param  int        $code
26
	 * @param  \Exception $previous
27
	 */
28
	public function __construct( $command_handler_name, $message = '', $code = 0, \Exception $previous = null ) {
29
		if ( empty( $message ) ) {
30
			$message = sprintf(
31
				__( 'The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso' ),
32
				$command_handler_name
33
			);
34
		}
35
		parent::__construct( $message, $code, $previous );
36
	}
37
38
}
39
// End of file CommandHandlerNotFoundException.php
40
// Location: core/services/commands/CommandHandlerNotFoundException.php

core/services/commands/InvalidCommandHandlerException.php 1 location

@@ 18-38 (lines=21) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class InvalidCommandHandlerException extends \DomainException
19
{
20
21
	/**
22
	 * @access public
23
	 * @param  string     $command_name
24
	 * @param  string     $message
25
	 * @param  int        $code
26
	 * @param  \Exception $previous
27
	 */
28
	public function __construct( $command_name, $message = '', $code = 0, \Exception $previous = null ) {
29
		if ( empty( $message ) ) {
30
			$message = sprintf(
31
				__( 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', 'event_espresso' ),
32
				$command_name
33
			);
34
		}
35
		parent::__construct( $message, $code, $previous );
36
	}
37
38
}
39
// End of file InvalidCommandHandlerException.php
40
// Location: core/services/commands/InvalidCommandHandlerException.php

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

@@ 20-45 (lines=26) @@
17
 * @author        Brent Christensen
18
 * @since         4.9.1
19
 */
20
class InstantiationException extends BadMethodCallException
21
{
22
23
    /**
24
     * InstantiationException constructor.
25
     *
26
     * @param string $identifier the name of the requested entity or service
27
     * @param string     $message
28
     * @param int        $code
29
     * @param \Exception $previous
30
     */
31
    public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null)
32
    {
33
        if (empty($message)) {
34
            $message = sprintf(
35
                __(
36
                    'The "%1$s" class could not be constructed.',
37
                    'event_espresso'
38
                ),
39
                $identifier
40
            );
41
        }
42
        parent::__construct($message, $code, $previous);
43
    }
44
45
}
46
// End of file InstantiationException.php
47
// Location: /InstantiationException.php

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

@@ 18-45 (lines=28) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class InvalidServiceException extends \UnexpectedValueException
19
{
20
21
    /**
22
     * InvalidServiceException constructor.
23
     *
24
     * @param string     $service_name the name of the requested service
25
     * @param string     $actual       classname of what we got
26
     * @param string     $message
27
     * @param int        $code
28
     * @param \Exception $previous
29
     */
30
    public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null)
31
    {
32
        if (empty($message)) {
33
            $message = sprintf(
34
                __(
35
                    'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.',
36
                    'event_espresso'
37
                ),
38
                $service_name,
39
                print_r($actual, true)
40
            );
41
        }
42
        parent::__construct($message, $code, $previous);
43
    }
44
45
}
46
// End of file InvalidServiceException.php
47
// Location: /InvalidServiceException.php

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

@@ 18-46 (lines=29) @@
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18
class ServiceExistsException extends \OutOfRangeException
19
{
20
21
22
    /**
23
     * ServiceExistsException constructor
24
     *
25
     * @param string     $service_name the name of the requested service
26
     * @param string     $message
27
     * @param int        $code
28
     * @param \Exception $previous
29
     */
30
    public function __construct(
31
        $service_name,
32
        $message = '',
33
        $code = 0,
34
        \Exception $previous = null
35
    ) {
36
        if (empty($message)) {
37
            $message = sprintf(
38
                __('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'),
39
                $service_name
40
            );
41
        }
42
        parent::__construct($message, $code, $previous);
43
    }
44
45
46
}
47
// End of file ServiceExistsException.php
48
// Location: /ServiceExistsException.php

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

@@ 18-43 (lines=26) @@
15
 * @author        Brent Christensen
16
 * @since         $VID:$
17
 */
18
class ServiceNotFoundException extends \RuntimeException
19
{
20
21
    /**
22
     * ServiceNotFoundException constructor
23
     *
24
     * @param string     $service_name the name of the requested service
25
     * @param string     $message
26
     * @param int        $code
27
     * @param \Exception $previous
28
     */
29
    public function __construct(
30
        $service_name,
31
        $message = '',
32
        $code = 0,
33
        \Exception $previous = null
34
    ) {
35
        if (empty($message)) {
36
            $message = sprintf(
37
                __('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'),
38
                $service_name
39
            );
40
        }
41
        parent::__construct($message, $code, $previous);
42
    }
43
}
44
// End of file ServiceNotFoundException.php
45
// Location: /ServiceNotFoundException.php

core/exceptions/InvalidSessionDataException.php 1 location

@@ 16-33 (lines=18) @@
13
 * @author        Brent Christensen
14
 * @since         $VID:$
15
 */
16
class InvalidSessionDataException extends \Exception {
17
18
	/**
19
	 * InvalidInterfaceException constructor.
20
	 *
21
	 * @param string     $message
22
	 * @param int        $code
23
	 * @param \Exception $previous
24
	 */
25
	public function __construct( $message = '', $code = 0, \Exception $previous = null ) {
26
		if ( empty( $message ) ) {
27
			$message = esc_html__( 'The session data is either missing or invalid.', 'event_espresso' );
28
		}
29
		parent::__construct( $message, $code, $previous );
30
	}
31
32
33
}
34
// End of file InvalidSessionDataException.php
35
// Location: EventEspresso\core\exceptions\InvalidSessionDataException.php

core/exceptions/InvalidStatusException.php 1 location

@@ 9-33 (lines=25) @@
6
use InvalidArgumentException;
7
8
9
class InvalidStatusException extends InvalidArgumentException
10
{
11
    /**
12
     * InvalidStatusException constructor.
13
     * @param string $status the invalid status id that was supplied
14
     * @param string $domain the name of the domain, model, or class that the status belongs to
15
     * @param string $message custom message
16
     * @param int $code
17
     * @param Exception|null $previous
18
     */
19
    public function __construct($status, $domain, $message = '', $code = 0, Exception $previous = null)
20
    {
21
        if (empty($message)) {
22
            $message = sprintf(
23
                __(
24
                    '"%1$s" is not a valid %2$s status',
25
                    'event_espresso'
26
                ),
27
                $status,
28
                $domain
29
            );
30
        }
31
        parent::__construct($message, $code, $previous);
32
    }
33
}
34