Completed
Push — master ( 705569...50fbec )
by dan
02:16
created

TestNotification::getDataArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 23
rs 9.0856
c 1
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace IrishDan\NotificationBundle\Test\Notification;
4
5
use IrishDan\NotificationBundle\Notification\NotificationInterface;
6
use IrishDan\NotificationBundle\Notification\NotifiableInterface;
7
8
class TestNotification implements NotificationInterface
9
{
10
    protected $notifiable;
11
    protected $channel;
12
    protected $uuid;
13
14
    public function setChannel($channel)
15
    {
16
        $this->channel = $channel;
17
    }
18
19
    public function getChannel()
20
    {
21
        return $this->channel;
22
    }
23
24
    public function getUuid()
25
    {
26
        return $this->uuid;
27
    }
28
29
    public function setUuid($uuid)
30
    {
31
        $this->uuid = $uuid;
32
    }
33
34
    public function getNotifiable()
35
    {
36
        return $this->notifiable;
37
    }
38
39
    public function setNotifiable(NotifiableInterface $notifiable)
40
    {
41
        $this->notifiable = $notifiable;
42
    }
43
44
    public function getChannels()
45
    {
46
        return ['mail', 'database', 'pusher', 'nexmo', 'slack'];
47
    }
48
49
    public function getDataArray()
50
    {
51
        // @TODO: Customise with your content.
52
        $messageData = [
53
            'title'  => 'New member',
54
            'body'   => 'New member, %s, just joined',
55
            'action' => [
56
                'url'  => 'http://danbyrne.me',
57
                'text' => 'click here',
58
            ],
59
        ];
60
61
        // switch ($this->channel) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
60% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
62
        //     case 'database':
63
        //         $messageData['database specific data']
64
        //         break;
65
        // case 'pusher':
66
        //         $messageData['icon'] = 'pusher-icon-class'
0 ignored issues
show
Unused Code Comprehensibility introduced by
56% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
67
        //         break;
68
        // }
69
70
        return $messageData;
71
    }
72
73
    public function getTemplate()
74
    {
75
        // The view template to use for this message. can switch depending on the channel.
76
        return 'NotificationBundle:Test:' . $this->channel . '.message.html.twig';
77
    }
78
}