Passed
Branch master (380333)
by Jakub
07:00
created

TestSuiteFactory::create()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 3
Bugs 0 Features 2
Metric Value
eloc 3
c 3
b 0
f 2
dl 0
loc 6
rs 10
ccs 3
cts 4
cp 0.75
cc 2
nc 2
nop 1
crap 2.0625
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
            throw new InvalidTestCaseException("$className is not a descendant of " . TestCase::class . ".");
17
        }
18 1
        return new $className();
19
    }
20
}
21