Passed
Pull Request — master (#75)
by
unknown
11:58 queued 10:50
created

CallbackRuleException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 10
ccs 0
cts 3
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getSolution() 0 3 1
A getName() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Exception;
6
7
use Yiisoft\FriendlyException\FriendlyExceptionInterface;
8
9
class CallbackRuleException extends \Exception implements FriendlyExceptionInterface
10
{
11
    public function getName(): string
12
    {
13
        return 'Invalid callable return value';
14
    }
15
16
    public function getSolution(): ?string
17
    {
18
        return <<<SOLUTION
19
            The callback must return an instance of \\Yiisoft\\Validator\\Result. An example of a valid callback:
20
                static function (): \\Yiisoft\\Validator\\Result
21
                {
22
                    \$result = new \\Yiisoft\\Validator\\Result();
23
24
                    ...
25
26
                    return \$result;
27
                }
28
        SOLUTION;
29
    }
30
}
31