Total Complexity | 7 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 2 | ||
Bugs | 1 | Features | 1 |
1 | <?php |
||
9 | class RequestStage extends AbstractStage |
||
10 | { |
||
11 | /** |
||
12 | * @return void |
||
13 | */ |
||
14 | 4 | public function processCommand() |
|
15 | { |
||
16 | 4 | if (!$this->getCommand()->hasAction() && $this->hasRequestMCA()) { |
|
17 | 3 | $this->saveRequestParamsInCommand(); |
|
18 | } |
||
19 | 4 | } |
|
20 | |||
21 | 3 | protected function saveRequestParamsInCommand() |
|
22 | { |
||
23 | 3 | $request = $this->getRequest(); |
|
24 | |||
25 | 3 | $this->getCommand()->setActionParam('module', $request->getModuleName()); |
|
26 | 3 | $this->getCommand()->setActionParam('controller', $request->getControllerName()); |
|
27 | 3 | $this->getCommand()->setActionParam('action', $request->getActionName()); |
|
28 | 3 | } |
|
29 | |||
30 | /** |
||
31 | * @return bool |
||
32 | */ |
||
33 | 4 | protected function hasRequestMCA() |
|
34 | { |
||
35 | 4 | return $this->getCommand()->hasRequest() && $this->getRequest()->getControllerName() !== null; |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @return \Nip\Request |
||
40 | */ |
||
41 | 3 | protected function getRequest() |
|
44 | } |
||
45 | } |
||
46 |