GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SendRegistrationEmail   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 35
loc 35
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A handle() 10 10 1
A failed() 4 4 1

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
2
3
namespace Afrittella\BackProject\Listeners;
4
5
use Afrittella\BackProject\Events\UserRegistered;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Afrittella\BackProject\Repositories\Users;
8
use Illuminate\Support\Facades\Log;
9
use Afrittella\BackProject\Notifications\RegistrationEmail;
10
11 View Code Duplication
class SendRegistrationEmail implements ShouldQueue
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
    protected $users;
14
    /**
15
     * Create the event listener.
16
     *
17
     */
18
    public function __construct(Users $users)
19
    {
20
        $this->users = $users;
21
    }
22
23
    /**
24
     * Handle the event.
25
     *
26
     * @param UserRegistered $event
27
     * @return void
28
     * @internal param $Event =UserRegistered  $event
29
     */
30
    public function handle(UserRegistered $event)
31
    {
32
        //try {
33
        $user = $this->users->findBy('id', $event->user_id);
34
        $user->notify(new RegistrationEmail($user));
35
        //} catch(\Exception $e) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
36
        //Log::error('lavoro fallito');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
37
        //}
38
39
    }
40
41
    public function failed(UserRegistered $event, $exception)
0 ignored issues
show
Unused Code introduced by
The parameter $event is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $exception is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
42
    {
43
        Log::error('fallito ');
44
    }
45
}
46