StreamCouldNotBeOpened   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 26
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFilePath() 0 3 1
A __construct() 0 5 1
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 stream could not be opened.
12
 */
13
final class StreamCouldNotBeOpened 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 stream could not be opened: ' . $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