Completed
Pull Request — master (#10)
by Fèvre
04:32 queued 02:08
created

BadgeNotification::toDatabase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 1
1
<?php
2
namespace Xetaravel\Notifications;
3
4
use Illuminate\Bus\Queueable;
5
use Illuminate\Notifications\Notification;
6
7
class BadgeNotification extends Notification
8
{
9
    use Queueable;
10
11
    public $badge;
12
13
    /**
14
     * Create a new notification instance.
15
     *
16
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
17
     */
18
    public function __construct($badge)
19
    {
20
        $this->badge = $badge;
21
    }
22
23
    /**
24
     * Get the notification's delivery channels.
25
     *
26
     * @param  mixed  $notifiable
27
     *
28
     * @return array
29
     */
30
    public function via($notifiable): array
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

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

Loading history...
31
    {
32
        return ['database'];
33
    }
34
35
    /**
36
     * Get the array representation of the notification.
37
     *
38
     * @param mixed $notifiable
39
     *
40
     * @return array
41
     */
42
    public function toDatabase($notifiable): array
0 ignored issues
show
Unused Code introduced by
The parameter $notifiable is not used and could be removed.

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

Loading history...
43
    {
44
        return [
45
            'message' => 'You have unlock the badge <strong>%s</strong> !',
46
            'message_key' => $this->badge->name,
47
            'image' => $this->badge->image,
48
            'type' => 'badge'
49
        ];
50
    }
51
}
52