Completed
Branch BUG-9871-email-validation (e62b1a)
by
unknown
350:41 queued 333:27
created

InvalidClassException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
namespace EventEspresso\core\exceptions;
3
4
if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
	exit( 'No direct script access allowed' );
6
}
7
8
9
10
/**
11
 * Class InvalidClassException
12
 * thrown when an invalid or missing class name is used
13
 *
14
*@package       Event Espresso
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18 View Code Duplication
class InvalidClassException extends \DomainException {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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