Passed
Pull Request — master (#24)
by Anton
02:47 queued 28s
created

ReactableInvalid   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 11
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A classNotExists() 0 3 1
A notImplementInterface() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of PHP Contracts: Love.
5
 *
6
 * (c) Anton Komarev <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cog\Contracts\Love\Reactable\Exceptions;
15
16
use Cog\Contracts\Love\Exceptions\LoveThrowable;
17
use Cog\Contracts\Love\Reactable\Models\Reactable as ReactableContract;
18
use RuntimeException;
19
20
final class ReactableInvalid extends RuntimeException implements
21
    LoveThrowable
22
{
23
    public static function classNotExists(string $type): self
24
    {
25
        return new static("[{$type}] class or morph map not found.");
26
    }
27
28
    public static function notImplementInterface(string $type): self
29
    {
30
        return new static(sprintf('[%s] must implement `%s` contract.', $type, ReactableContract::class));
31
    }
32
}
33