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

FileAccessException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 37
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A notWritable() 0 4 1
A notReadable() 0 4 1
A failedOverwrite() 0 8 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