-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleFactory.php
More file actions
61 lines (49 loc) · 1.36 KB
/
Copy pathModuleFactory.php
File metadata and controls
61 lines (49 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace TaskChecker;
use TaskChecker\Codebot\ClientInterface;
use TaskChecker\Reporter\Report;
use TaskChecker\Test\BaseTest;
use TaskChecker\TextScanner\VariableInjector;
class ModuleFactory
{
private $codebotClient;
private $injector;
public function __construct(ClientInterface $codebotClient)
{
$this->codebotClient = $codebotClient;
$this->injector = new VariableInjector;
}
public function getModule($name, BaseTest $test, Report $reporter)
{
$method = 'getModule' . ucfirst($name);
return $this->$method($test, $reporter);
}
public function hasModule($name)
{
$method = 'getModule' . ucfirst($name);
return method_exists($this, $method);
}
public function getModuleRunner(BaseTest $test, Report $reporter)
{
return new Module\Runner(
$this->codebotClient,
$this->injector,
$reporter,
$test->getSolutionCode()
);
}
public function getModuleReader(BaseTest $test, Report $reporter)
{
return new Module\Reader(
$reporter
);
}
public function getModuleUtil()
{
return new Module\Util;
}
public function getModuleAssert(BaseTest $test, Report $reporter)
{
return new Module\Assert($reporter);
}
}