CannotExtractConstantsException   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 24
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidPattern() 0 6 1
A classDoNotExists() 0 4 1
A classHasNoPublicConstant() 0 4 1
A noConstantMatchingPattern() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yokai\EnumBundle\Exception;
6
7
use InvalidArgumentException;
8
9
/**
10
 * @author Yann Eugoné <[email protected]>
11
 */
12
class CannotExtractConstantsException extends InvalidArgumentException
13
{
14
    public static function invalidPattern(string $pattern): self
15
    {
16
        return new self(
17
            "Constant extraction pattern must look like Fully\\Qualified\\ClassName::CONSTANT_*. Got $pattern."
18
        );
19
    }
20
21
    public static function classDoNotExists(string $class): self
22
    {
23
        return new self("Class $class do not exists.");
24
    }
25
26
    public static function classHasNoPublicConstant(string $class): self
27
    {
28
        return new self("Class $class has no public constant.");
29
    }
30
31
    public static function noConstantMatchingPattern(string $pattern): self
32
    {
33
        return new self("Pattern $pattern matches no constant.");
34
    }
35
}
36