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

PremiumUserSignup::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
ccs 5
cts 5
cp 1
cc 1
eloc 4
nc 1
nop 1
crap 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