Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
FileNotFoundException | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Hyde\Framework\Exceptions; |
6 | |
7 | use Exception; |
8 | use Hyde\Hyde; |
9 | |
10 | use function sprintf; |
11 | |
12 | class FileNotFoundException extends Exception |
13 | { |
14 | /** @var string */ |
15 | protected $message = 'File not found.'; |
16 | |
17 | /** @var int */ |
18 | protected $code = 404; |
19 | |
20 | public function __construct(?string $path = null, ?string $customMessage = null) |
21 | { |
22 | parent::__construct($customMessage ?? ($path ? sprintf('File [%s] not found.', Hyde::pathToRelative($path)) : $this->message)); |
23 | } |
24 | } |