InvalidPlugin   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A doesntImplementPluginInterface() 0 4 1
A configurationFileNotFound() 0 4 1
A configurationMustBeArray() 0 4 1
A serviceFileNotFound() 0 4 1
1
<?php
2
3
namespace Stitcher\Exception;
4
5
use Exception;
6
7
class InvalidPlugin extends Exception
8
{
9
    public static function doesntImplementPluginInterface(string $class): InvalidPlugin
10
    {
11
        return new self("Plugin `{$class}` doesn't implement `Stitcher\Plugin`");
12
    }
13
14
    public static function configurationFileNotFound(string $class, string $configurationPath): InvalidPlugin
15
    {
16
        return new self("Configuration file for plugin `{$class}` not found. Searched for `{$configurationPath}`.");
17
    }
18
19
    public static function configurationMustBeArray(string $class, string $configurationPath): InvalidPlugin
20
    {
21
        return new self("Configuration file for plugin `{$class}` must return an array. Searched in `{$configurationPath}`.");
22
    }
23
24
    public static function serviceFileNotFound(string $class, string $servicePath): InvalidPlugin
25
    {
26
        return new self("Service file for plugin `{$class}` not found. Searched for `{$servicePath}`.");
27
    }
28
}
29