Conditions | 6 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
16 | 13 | public function runAsController(Request $request) |
|
17 | { |
||
18 | 13 | $this->runningAs = 'controller'; |
|
|
|||
19 | 13 | $this->request = $request; |
|
20 | |||
21 | 13 | $this->reset($request->user()); |
|
22 | 13 | $this->fill($this->getAttributesFromRequest($request)); |
|
23 | |||
24 | 13 | $result = $this->run(); |
|
25 | |||
26 | 10 | if (method_exists($this, 'response')) { |
|
27 | 5 | return $this->response($result, $request); |
|
28 | } |
||
29 | |||
30 | 5 | if (method_exists($this, 'jsonResponse') && $request->wantsJson()) { |
|
31 | 1 | return $this->jsonResponse($result, $request); |
|
32 | } |
||
33 | |||
34 | 4 | if (method_exists($this, 'htmlResponse') && ! $request->wantsJson()) { |
|
35 | 1 | return $this->htmlResponse($result, $request); |
|
36 | } |
||
37 | |||
38 | 3 | return $result; |
|
39 | } |
||
61 |