Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
FileNotFoundException
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2
3declare(strict_types=1);
4
5namespace Hyde\Framework\Exceptions;
6
7use Exception;
8use Hyde\Hyde;
9
10use function sprintf;
11
12class 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}