Completed
Push — master ( 483be6...2f25cf )
by Marco
04:50
created

fromNotWritableDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 8
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ProxyManager\Exception;
6
7
use UnexpectedValueException;
8
use function sprintf;
9
10
/**
11
 * Exception for non writable files
12
 *
13
 */
14
class FileNotWritableException extends UnexpectedValueException implements ExceptionInterface
15
{
16 1
    public static function fromInvalidMoveOperation(string $fromPath, string $toPath) : self
17
    {
18 1
        return new self(sprintf(
19
            'Could not move file "%s" to location "%s": '
20 1
            . 'either the source file is not readable, or the destination is not writable',
21 1
            $fromPath,
22 1
            $toPath
23
        ));
24
    }
25
26 1
    public static function fromNotWritableDirectory(string $directory) : self
27
    {
28 1
        return new self(sprintf(
29
            'Could not create temp file in directory "%s" '
30 1
            . 'either the directory does not exist, or it is not writable',
31 1
            $directory
32
        ));
33
    }
34
}
35