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

InvalidFilePathException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
cc 2
eloc 10
nc 2
nop 4
dl 14
loc 14
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
9
10
/**
11
 * Class InvalidFilePathException
12
 * thrown when is_readable() returns false for a given filepath
13
 *
14
 * @package       Event Espresso
15
 * @author        Brent Christensen
16
 * @since         4.9.0
17
 */
18 View Code Duplication
class InvalidFilePathException 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...
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