GrowlNotifyWindowsBuilder   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 11
Bugs 0 Features 4
Metric Value
wmc 7
c 11
b 0
f 4
lcom 1
cbo 1
dl 0
loc 38
ccs 18
cts 18
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C build() 0 22 7
1
<?php
2
3
namespace BryanCrowe\Growl\Builder;
4
5
/**
6
 * This class is a builder for growlnotify for Windows commands.
7
 */
8
class GrowlNotifyWindowsBuilder extends BuilderAbstract
9
{
10
    /**
11
     * The notifier's path.
12
     *
13
     * @var string
14
     */
15
    protected $path = 'growlnotify';
16
17
    /**
18
     * Builds the growlnotify command to be executed.
19
     *
20
     * @param array $options An array of options to use for building the command.
21
     * @return string The fully-built command to execute.
22
     */
23 3
    public function build($options)
24
    {
25 3
        $command = $this->path;
26
27 3
        if (isset($options['title'])) {
28 3
            $command .= " /t:{$options['title']}";
29 3
        }
30 3
        if (isset($options['image'])) {
31 3
            $command .= " /i:{$options['image']}";
32 3
        }
33 3
        if (isset($options['url'])) {
34 3
            $command .= " /cu:{$options['url']}";
35 3
        }
36 3
        if (isset($options['sticky']) && $options['sticky'] === true) {
37 3
            $command .= ' /s:true';
38 3
        }
39 3
        if (isset($options['message'])) {
40 3
            $command .= " {$options['message']}";
41 3
        }
42
43 3
        return $command;
44
    }
45
}
46