AskDestlerController::submit()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 12
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 12
loc 12
rs 9.4286
cc 1
eloc 7
nc 1
nop 2
1
<?php namespace WITR\Http\Controllers;
2
3
use WITR\Http\Requests\AskDestlerRequest;
4
use WITR\Http\Controllers\Controller;
5
use Illuminate\Contracts\Mail\Mailer;
6
use WITR\SystemSetting;
7
8
use Illuminate\Http\Request;
9
10
class AskDestlerController extends Controller {
11
12
	public function index()
13
	{
14
		$destlerText = SystemSetting::askDestlerText();
0 ignored issues
show
Bug introduced by
The method askDestlerText() does not exist on WITR\SystemSetting. Did you maybe mean scopeAskDestlerText()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
15
		return view('askdestler.index', ['destlerText' => $destlerText]);
16
	}
17
18 View Code Duplication
	public function submit(Mailer $mailer, AskDestlerRequest $request)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
	{
20
		$askdestlerRecipient = app('config')['witr.askdestler_recipient'];
21
		$mailer->send('emails.askdestler', $request->all(), function($message) use ($askdestlerRecipient)
22
		{
23
			$message->to($askdestlerRecipient['email'], $askdestlerRecipient['name'])
24
					->subject('WITR Ask Destler Submission');
25
		});
26
27
		return redirect()->route('askdestler')
28
			->with('success', 'Question Submitted!');
29
	}
30
}
31