Completed
Push — master ( 9003e7...f2c4d3 )
by ReliQ
04:59
created

InvalidAssetDirectory::forDirectory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ReliQArts\Docweaver\Exceptions\Product;
6
7
use ReliQArts\Docweaver\Contracts\Exception;
8
use ReliQArts\Docweaver\Exceptions\InvalidDirectory;
9
10
final class InvalidAssetDirectory extends InvalidDirectory
11
{
12
    private const CODE = 4003;
13
14
    /**
15
     * @param string         $directory
16
     * @param null|Exception $previous
17
     *
18
     * @return Exception
19
     */
20
    public static function forDirectory(string $directory, Exception $previous = null): Exception
21
    {
22
        $message = sprintf('Invalid asset directory: `%s`.', $directory);
23
        $self = new self($message, self::CODE, $previous);
24
        $self->directory = $directory;
25
26
        return $self;
27
    }
28
}
29