Completed
Pull Request — master (#27)
by Karl
05:54
created

PremiumUserSignup   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A handle() 0 9 1
1
<?php namespace JobApis\JobsToMail\Jobs\Users;
2
3
use JobApis\JobsToMail\Http\Messages\FlashMessage;
4
use JobApis\JobsToMail\Models\User;
5
use JobApis\JobsToMail\Notifications\PremiumUserSignup as Notification;
6
7
class PremiumUserSignup
8
{
9
    /**
10
     * @var User $admin
11
     */
12
    public $admin;
13
14
    /**
15
     * @var string $data
16
     */
17
    public $data;
18
19
    /**
20
     * Create a new job instance.
21
     */
22 1
    public function __construct($data = [])
23
    {
24 1
        $this->data = $data;
0 ignored issues
show
Documentation Bug introduced by
It seems like $data of type array is incompatible with the declared type string of property $data.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
25 1
        $this->admin = new User(
26 1
            ['email' => env('ADMIN_EMAIL', '[email protected]')]
27
        );
28 1
    }
29
30
    /**
31
     * Send an email to the admin about this new user signup
32
     *
33
     * @return FlashMessage
34
     */
35 1
    public function handle()
36
    {
37 1
        $this->admin->notify(new Notification($this->data));
38
39 1
        return new FlashMessage(
40 1
            'alert-success',
41 1
            'We have received your request for Premium access. We will reach out within 48 hours.'
42
        );
43
    }
44
}
45