BadModifierException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mustBePublic() 0 7 1
A mustBeStatic() 0 7 1
1
<?php
2
declare(strict_types=1);
3
4
namespace TheCodingMachine\Funky;
5
6
use \ReflectionMethod;
7
8
class BadModifierException extends \Exception
9
{
10
11
    public static function mustBePublic(ReflectionMethod $reflectionMethod, string $annotation): self
12
    {
13
        return new self(sprintf(
14
            'Method %s::%s annotated with annotation %s must be public.',
15
            $reflectionMethod->getDeclaringClass()->getName(),
16
            $reflectionMethod->getName(),
17
            $annotation
18
        ));
19
    }
20
21
    public static function mustBeStatic(ReflectionMethod $reflectionMethod, string $annotation): self
22
    {
23
        return new self(sprintf(
24
            'Method %s::%s annotated with annotation %s must be static.',
25
            $reflectionMethod->getDeclaringClass()->getName(),
26
            $reflectionMethod->getName(),
27
            $annotation
28
        ));
29
    }
30
}
31