Completed
Push — master ( c26f0f...c7af1e )
by Konstantinos
18:52
created

NotificationAdapter   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 19
ccs 0
cts 2
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
trigger() 0 1 ?
A isEnabled() 0 5 1
1
<?php
2
/**
3
 * This file contains a unifying class for all the notification adapters for push services
4
 *
5
 * @package    BZiON\NotificationAdapters
6
 * @license    https://github.com/allejo/bzion/blob/master/LICENSE.md GNU General Public License Version 3
7
 */
8
9
namespace BZIon\NotificationAdapter;
10
11
/**
12
 * An external push service, used to send notifications to users in real-time
13
 * while they are using the web interface
14
 * @package    BZiON\NotificationAdapters
15
 */
16
abstract class NotificationAdapter
17
{
18
    /**
19
     * Find whether we should/can send messages using this adapter
20
     * @return bool
21
     */
22
    public static function isEnabled()
23
    {
24
        // Don't push notifications when testing
25
        return \Service::getEnvironment() != "test";
26
    }
27
28
    /**
29
     * Trigger a notification
30
     * @param string $channel The channel to send the message on
31
     * @param string $message The content of the message to send
32
     */
33
    abstract public function trigger($channel, $message);
34
}
35