ergebnis / classy
1
<?php
2

3
declare(strict_types=1);
4

5
/**
6
 * Copyright (c) 2017-2020 Andreas Möller
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE.md file that was distributed with this source code.
10
 *
11
 * @see https://github.com/ergebnis/classy
12
 */
13

14
namespace Ergebnis\Classy\Exception;
15

16
final class DirectoryDoesNotExist extends \InvalidArgumentException implements ExceptionInterface
17
{
18
    /**
19
     * @var string
20
     */
21
    private $directory;
22

23
    /**
24
     * Returns a new exception from a directory.
25
     *
26
     * @param string $directory
27
     *
28
     * @return self
29
     */
30 1
    public static function fromDirectory(string $directory): self
31
    {
32 1
        $exception = new self(\sprintf(
33 1
            'Directory "%s" does not exist.',
34 1
            $directory
35
        ));
36

37 1
        $exception->directory = $directory;
38

39 1
        return $exception;
40
    }
41

42
    /**
43
     * Returns the directory.
44
     *
45
     * @return string
46
     */
47 1
    public function directory(): string
48
    {
49 1
        return $this->directory;
50
    }
51
}

Read our documentation on viewing source code .

Loading