Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
19:19
created

InvalidIdentifierException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 13 13 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
 * Class InvalidIdentifierException
9
 * thrown when an identifier is invalid
10
 *
11
 * @package       Event Espresso
12
 * @author        Brent Christensen
13
 * @since         4.9.0
14
 */
15 View Code Duplication
 class InvalidIdentifierException extends \InvalidArgumentException {
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...
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