FileCouldNotBeFound::getFilePath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Stadly\FileWaiter\Exception;
6
7
use RuntimeException;
8
use Throwable;
9
10
/**
11
 * Exception thrown when a file could not be found.
12
 */
13
final class FileCouldNotBeFound extends RuntimeException
14
{
15
    /**
16
     * @var string Path to file.
17
     */
18
    private $filePath;
19
20
    /**
21
     * Constructor.
22
     *
23
     * @param string $filePath Path to file.
24
     * @param Throwable $previous Previous exception, used for exception chaining.
25
     */
26 1
    public function __construct(string $filePath, ?Throwable $previous = null)
27
    {
28 1
        $this->filePath = $filePath;
29
30 1
        parent::__construct('File could not be found: ' . $filePath, /*code*/0, $previous);
31
    }
32
33
    /**
34
     * @return string Path to file.
35
     */
36 1
    public function getFilePath(): string
37
    {
38 1
        return $this->filePath;
39
    }
40
}
41