Completed
Push — dev ( 87a06e...746aba )
by Zach
02:16
created

WriteError::classExists()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Yarak\Exceptions;
4
5
use Exception;
6
7
class WriteError extends Exception
8
{
9
    /**
10
     * Writing to the filesystem failed.
11
     *
12
     * @param string $path
13
     *
14
     * @return static
15
     */
16
    public static function fileWriteFailed($e, $path = '')
17
    {
18
        $message = "Writing to {$path} failed."."\n".$e;
19
20
        return new static($message);
21
    }
22
23
    /**
24
     * Writing to the filesystem failed because the given class exists.
25
     *
26
     * @param string $class
27
     *
28
     * @return static
29
     */
30
    public static function classExists($class)
31
    {
32
        return new static("Class {$class} already exists.");
33
    }
34
}
35