Notify   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 47.83 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 4
Bugs 0 Features 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 11
loc 23
rs 10
c 4
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A after() 11 11 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php namespace Cerbero\Auth\Pipes\Recover;
2
3
use Cerbero\Auth\Pipes\AbstractPipe;
4
use Illuminate\Contracts\Mail\Mailer;
5
6
class Notify extends AbstractPipe {
7
8
	/**
9
	 * Run after the handled job.
10
	 *
11
	 * @param	Illuminate\Contracts\Mail\Mailer	$mailer
12
	 * @param	mixed	$handled
13
	 * @param	Cerbero\Auth\Jobs\RecoverJob	$job
14
	 * @return	mixed
15
	 */
16 View Code Duplication
	public function after(Mailer $mailer, $handled, $job)
17
	{
18
		$email = $job->email;
19
20
		$method = config('_auth.recover.email.queue') ? 'queue' : 'send';
21
22
		$mailer->$method(config('_auth.recover.email.view'), ['token' => $handled], function($message) use($email)
23
		{
24
			$message->to($email)->subject(trans('auth::recover.email_subject'));
25
		});
26
	}
27
28
}
29