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

TestSuiteFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 2
Metric Value
eloc 3
c 3
b 0
f 2
dl 0
loc 6
rs 10
ccs 4
cts 4
cp 1
cc 2
nc 2
nop 1
crap 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