Conditions | 2 |
Paths | 2 |
Total Lines | 19 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php namespace Distilleries\Expendable\States; |
||
37 | 10 | public function postExport(Request $request) |
|
38 | { |
||
39 | |||
40 | 10 | $form = FormBuilder::create($this->export_form, [ |
|
41 | 10 | 'model' => $this->model |
|
42 | ]); |
||
43 | |||
44 | |||
45 | 10 | if ($form->hasError()) |
|
46 | { |
||
47 | 6 | return $form->validateAndRedirectBack(); |
|
48 | } |
||
49 | |||
50 | |||
51 | 4 | $data = $request->all(); |
|
52 | 4 | $filename = $data['range']['start'] . ' ' . $data['range']['end'] . '.' . $data['type']; |
|
53 | |||
54 | 4 | return (new BaseExport($this->model, $data))->export($filename); |
|
55 | } |
||
56 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: