Role   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A verify() 0 9 2
1
<?php
2
3
/* this file is part of pipelines */
4
5
namespace Ktomk\Pipelines\Runner\Containers;
6
7
use UnexpectedValueException;
8
9
/**
10
 * Class Role
11
 *
12
 * @package Ktomk\Pipelines\Runner\Containers
13
 */
14
abstract class Role
15
{
16
    public static $roles = array('pipe', 'service', 'step');
17
18
    /**
19
     * @param string $role
20
     *
21
     * @throws UnexpectedValueException
22
     *
23
     * @return string representing a container role
24
     */
25 1
    public static function verify($role)
26
    {
27 1
        $roles = self::$roles;
28 1
        if (in_array($role, $roles, true)) {
29 1
            return $role;
30
        }
31
32 1
        throw new UnexpectedValueException(
33 1
            sprintf('Not a role: "%s"; Roles are: "%s"', $role, implode('", "', $roles))
34
        );
35
    }
36
}
37