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

InvalidIdentifierException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 9
nc 2
nop 5
dl 13
loc 13
rs 9.4285
c 0
b 0
f 0
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