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

NotificationAdapter::isEnabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 9.4285
cc 1
eloc 2
nc 1
nop 0
crap 2
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