Completed
Push — master ( 529067...858b09 )
by Peter
20s queued 11s
created

FileAccessException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 52
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A notWritable() 0 4 1
A notReadable() 0 4 1
A failedOverwrite() 0 8 1
A failedCreateUnique() 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 1
            $target_filename,
45
            $tmp_filename
46 1
        ));
47
    }
48
49
    /**
50
     * @param string $path
51
     * @param string $prefix
52
     *
53
     * @return self
54
     */
55 1
    final public static function failedCreateUnique($path, $prefix)
56
    {
57 1
        return new self(sprintf(
58 1
            'Failed create file with unique file name in folder "%s" with prefix "%s".',
59 1
            $path,
60
            $prefix
61 1
        ));
62
    }
63
}
64