Completed
Push — 0.4 ( e232e8...87763b )
by Diego
05:27
created

RemoveMailchimpMember::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php namespace DiegoCaprioli\Larachimp\Jobs;
2
3
use DiegoCaprioli\Larachimp\Models\LarachimpListMember;
4
use DiegoCaprioli\Larachimp\Services\MailchimpManager;
5
use Illuminate\Contracts\Bus\SelfHandling;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Queue\InteractsWithQueue;
8
use Illuminate\Queue\SerializesModels;
9
use Illuminate\Support\Facades\App;
10
11
/**
12
 * Updates the user's email in the Mailchimp list
13
 */
14 View Code Duplication
class RemoveMailchimpMember implements SelfHandling, 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...
15
{
16
    use InteractsWithQueue, SerializesModels;
17
18
    /**
19
     * The old email that needs to be replaced with the new one on the member
20
     * 
21
     * @var string
22
     */
23
    private $email;
24
25
    /**
26
     * Create a new job instance.
27
     * 
28
     * @param \DiegoCaprioli\Larachimp\Models\LarachimpListMember $member
0 ignored issues
show
Bug introduced by
There is no parameter named $member. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
29
     */
30 2
    public function __construct($email)
31
    {        
32 2
        $this->email = $email;
33 2
    }
34
35
    /**
36
     * Execute the job.
37
     */
38 2
    public function handle()
39
    {
40
        // The Job only executes if the apiKey is set! This works sort of an
41
        // on/off switch
42 2
        if (!empty(config('diegocaprioli.larachimp.larachimp.apikey'))) {
43 2
            $manager = App::make(MailchimpManager::class);
44 2
            $manager->removeListMember($this->email);
45 2
        }        
46 2
    }
47
}
48