Desktop::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 7
nc 1
nop 2
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