Passed
Push — master ( 777840...f4bbd1 )
by Stephen
50s queued 11s
created

Notification::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Sfneal\PostOffice\Notifications;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Bus\Queueable as QueueableTrait;
7
use Illuminate\Contracts\Queue\ShouldQueue;
8
use Illuminate\Notifications\Messages\MailMessage;
9
use Illuminate\Queue\InteractsWithQueue;
10
use Illuminate\Queue\SerializesModels;
11
use Sfneal\PostOffice\Mailables\Mailable;
12
13
abstract class Notification extends \Illuminate\Notifications\Notification implements ShouldQueue
14
{
15
    use Queueable, InteractsWithQueue, QueueableTrait, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Sfneal\PostOffice\Notifications\Notification: $relations, $class, $keyBy
Loading history...
16
17
    /**
18
     * @var array channels to send notification via
19
     */
20
    private const VIA = ['mail'];
21
22
    /**
23
     * @var array channels to send notification via
24
     */
25
    public $via;
26
27
    /**
28
     * Create a new notification instance.
29
     */
30
    public function __construct()
31
    {
32
        $this->via = $this->via ?? ['mail'];
33
        $this->onQueue(config('post-office.queue'));
34
        $this->onConnection(config('post-office.driver'));
35
    }
36
37
    /**
38
     * Get the notification's delivery channels.
39
     *
40
     * @param  mixed  $notifiable
41
     * @return array
42
     */
43
    public function via($notifiable): array
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

43
    public function via(/** @scrutinizer ignore-unused */ $notifiable): array

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
44
    {
45
        return $this->via;
46
    }
47
48
    /**
49
     * Get the mail representation of the notification.
50
     *
51
     * @param  mixed  $notifiable
52
     * @return MailMessage|Mailable
53
     */
54
    abstract public function toMail($notifiable);
55
56
    /**
57
     * Get the array representation of the notification.
58
     *
59
     * @param  mixed  $notifiable
60
     * @return array
61
     */
62
    abstract public function toArray($notifiable): array;
63
}
64