Test Failed
Push — main ( d83f6c...37d714 )
by Davide
28:29 queued 10:26
created

NotificationService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 10
c 2
b 0
f 0
dl 0
loc 49
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A sendEmailGetATreatment() 0 6 1
A sendEmailContactMe() 0 6 1
A sendEmailNewTestimonial() 0 6 1
1
<?php
2
3
namespace App\Services;
4
5
use App\Models\User;
6
use App\Notifications\ContactMeMailNotification;
7
use App\Notifications\GetATreatmentMailNotification;
8
use App\Notifications\NewTestimonialMailNotification;
9
10
class NotificationService
11
{
12
13
    /**
14
     * Send an email when the contact form is submitted
15
     *
16
     * @param array $data
17
     * @param int $userId
18
     *
19
     * @return bool
20
     */
21
    public function sendEmailContactMe(array $data, int $userId): bool
22
    {
23
        $user = User::find($userId);
24
        $user->notify(new ContactMeMailNotification($data));
25
26
        return true;
27
    }
28
29
    /**
30
     * Send an email when the get a treatment form is submitted
31
     *
32
     * @param array $data
33
     * @param int $userId
34
     *
35
     * @return bool
36
     */
37
    public function sendEmailGetATreatment(array $data, int $userId): bool
38
    {
39
        $user = User::find($userId);
40
        $user->notify(new GetATreatmentMailNotification($data));
41
42
        return true;
43
    }
44
45
    /**
46
     * Send an email when the new testimonial form is submitted
47
     *
48
     * @param  array  $data
49
     * @param  int  $userId
50
     *
51
     * @return bool
52
     */
53
    public function sendEmailNewTestimonial(array $data, int $userId): bool
54
    {
55
        $user = User::find($userId);
56
        $user->notify(new NewTestimonialMailNotification($data));
57
58
        return true;
59
    }
60
61
}
62