Delete   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 36
rs 10
c 0
b 0
f 0
ccs 11
cts 11
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 13 2
1
<?php namespace JobApis\JobsToMail\Jobs\Searches;
2
3
use JobApis\JobsToMail\Http\Messages\FlashMessage;
4
use JobApis\JobsToMail\Repositories\Contracts\SearchRepositoryInterface;
5
6
class Delete
7
{
8
    /**
9
     * @var string $searchId
10
     */
11
    protected $searchId;
12
13
    /**
14
     * Create a new job instance.
15
     */
16 2
    public function __construct($searchId = null)
17
    {
18 2
        $this->searchId = $searchId;
19 2
    }
20
21
    /**
22
     * Unsubscribe from a search by deleting it.
23
     *
24
     * @param SearchRepositoryInterface $users
0 ignored issues
show
Bug introduced by
There is no parameter named $users. 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...
25
     *
26
     * @return FlashMessage
27
     */
28 2
    public function handle(SearchRepositoryInterface $searches)
29
    {
30 2
        if ($searches->delete($this->searchId)) {
31 1
            return new FlashMessage(
32 1
                'alert-success',
33 1
                'You will no longer receive emails for this search.'
34
            );
35
        }
36 1
        return new FlashMessage(
37 1
            'alert-danger',
38 1
            'We couldn\'t unsubscribe you. Please try again later or contact us.'
39
        );
40
    }
41
}
42