Code Duplication    Length = 20-20 lines in 2 locations

src/Exception/DirectoryException.php 1 location

@@ 8-27 (lines=20) @@
5
use Equip\Action;
6
use InvalidArgumentException;
7
8
class DirectoryException extends InvalidArgumentException
9
{
10
    /**
11
     * @param mixed $value
12
     *
13
     * @return static
14
     */
15
    public static function invalidEntry($value)
16
    {
17
        if (is_object($value)) {
18
            $value = get_class($value);
19
        }
20
21
        return new static(sprintf(
22
            'Directory entry `%s` is not an `%s` instance',
23
            $value,
24
            Action::class
25
        ));
26
    }
27
}
28

src/Exception/ResponderException.php 1 location

@@ 8-27 (lines=20) @@
5
use Equip\Adr\ResponderInterface;
6
use InvalidArgumentException;
7
8
class ResponderException extends InvalidArgumentException
9
{
10
    /**
11
     * @param string|object $spec
12
     *
13
     * @return static
14
     */
15
    public static function invalidClass($spec)
16
    {
17
        if (is_object($spec)) {
18
            $spec = get_class($spec);
19
        }
20
21
        return new static(sprintf(
22
            'Responder class `%s` must implement `%s`',
23
            $spec,
24
            ResponderInterface::class
25
        ));
26
    }
27
}
28