Desktop   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
A notify() 0 9 1
1
<?php
2
3
namespace Behatch\Notifier;
4
5
class Desktop extends Notifier
6
{
7
    static private $icons = [];
8
9
    public function __construct($spamTimeout = 60, $icons = [])
10
    {
11
        parent::__construct($spamTimeout);
12
13
        $behatchDir = __DIR__ . '/Resources';
14
15
        self::$icons = $icons + [
16
            'sad' => "$behatchDir/images/gnome-sad.png",
17
            'smile' => "$behatchDir/images/gnome-smile.png",
18
            'error' => "$behatchDir/images/gnome-error.png",
19
        ];
20
    }
21
22
    protected static function notify($status, $title, $message)
23
    {
24
        $cmd = sprintf(
25
            "notify-send -i '%s' '%s' '%s'",
26
            self::$icons[$status], $title, $message
27
        );
28
29
        exec($cmd);
30
    }
31
}
32