Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
WorkflowLoader | |
0.00% |
0 / 8 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getWorkflow | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getBlocks | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
handleSubmit | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
commit | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace Flow; |
4 | |
5 | use Flow\Block\AbstractBlock; |
6 | use Flow\Model\Workflow; |
7 | use MediaWiki\Context\IContextSource; |
8 | |
9 | class WorkflowLoader { |
10 | /** |
11 | * @var Workflow |
12 | */ |
13 | protected $workflow; |
14 | |
15 | /** |
16 | * @var AbstractBlock[] |
17 | */ |
18 | protected $blocks; |
19 | |
20 | /** |
21 | * @var SubmissionHandler |
22 | */ |
23 | protected $submissionHandler; |
24 | |
25 | /** |
26 | * @param Workflow $workflow |
27 | * @param AbstractBlock[] $blocks |
28 | * @param SubmissionHandler $submissionHandler |
29 | */ |
30 | public function __construct( |
31 | Workflow $workflow, |
32 | array $blocks, |
33 | SubmissionHandler $submissionHandler |
34 | ) { |
35 | $this->blocks = $blocks; |
36 | $this->submissionHandler = $submissionHandler; |
37 | $this->workflow = $workflow; |
38 | } |
39 | |
40 | /** |
41 | * @return Workflow |
42 | */ |
43 | public function getWorkflow() { |
44 | return $this->workflow; |
45 | } |
46 | |
47 | /** |
48 | * @return AbstractBlock[] |
49 | */ |
50 | public function getBlocks() { |
51 | return $this->blocks; |
52 | } |
53 | |
54 | /** |
55 | * @param IContextSource $context |
56 | * @param string $action |
57 | * @param array $parameters |
58 | * @return AbstractBlock[] |
59 | */ |
60 | public function handleSubmit( IContextSource $context, $action, array $parameters ) { |
61 | return $this->submissionHandler |
62 | ->handleSubmit( $this->workflow, $context, $this->blocks, $action, $parameters ); |
63 | } |
64 | |
65 | public function commit( array $blocks ) { |
66 | return $this->submissionHandler->commit( $this->workflow, $blocks ); |
67 | } |
68 | } |