Passed
Push — master ( b0febc...99b0a5 )
by Jakub
01:55
created

TestSuiteFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace MyTester;
6
7
/**
8
 * @author Jakub Konečný
9
 * @internal
10
 */
11
final class TestSuiteFactory implements ITestSuiteFactory
12
{
13 1
    public function create(string $className): TestCase
14
    {
15 1
        if (!is_subclass_of($className, TestCase::class)) {
16 1
            throw new InvalidTestCaseException("$className is not a descendant of " . TestCase::class . ".");
17
        }
18 1
        return new $className();
19
    }
20
}
21