Completed
Push — master ( d47b87...74095d )
by Peter
29s queued 11s
created

FileAccessException::notReadable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Component\Sitemap\Stream\Exception;
11
12
class FileAccessException extends \RuntimeException
13
{
14
    /**
15
     * @param string $filename
16
     *
17
     * @return static
18
     */
19 1
    final public static function notWritable($filename)
20
    {
21 1
        return new static(sprintf('File "%s" is not writable.', $filename));
22
    }
23
24
    /**
25
     * @param string $filename
26
     *
27
     * @return static
28
     */
29 2
    final public static function notReadable($filename)
30
    {
31 2
        return new static(sprintf('File "%s" is not readable.', $filename));
32
    }
33
34
    /**
35
     * @param string $tmp_filename
36
     * @param string $target_filename
37
     *
38
     * @return self
39
     */
40 1
    final public static function failedOverwrite($tmp_filename, $target_filename)
41
    {
42 1
        return new self(sprintf(
43 1
            'Failed to overwrite file "%s" from temporary file "%s".',
44
            $target_filename,
45
            $tmp_filename
46
        ));
47
    }
48
}
49