BuilderAbstract   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 19
Bugs 1 Features 5
Metric Value
wmc 3
c 19
b 1
f 5
lcom 0
cbo 0
dl 0
loc 39
ccs 8
cts 8
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 3
build() 0 1 ?
1
<?php
2
3
namespace BryanCrowe\Growl\Builder;
4
5
use InvalidArgumentException;
6
7
/**
8
 * Abstract Builder class
9
 */
10
abstract class BuilderAbstract implements BuilderInterface
11
{
12
    /**
13
     * The notifier's path.
14
     *
15
     * @var string
16
     */
17
    protected $path;
18
19
    /**
20
     * Constructor. Offers an opportunity to set a notifier's alias/path.
21
     *
22
     * @param string|null $path The path to the notifier's CLI.
23
     * @throws \InvalidArgumentException If the argument isn't a string.
24
     */
25 42
    public function __construct($path = null)
26
    {
27 42
        if ($path === null) {
28 42
            return;
29
        }
30 9
        if (is_string($path)) {
31 9
            $this->path = $path;
32 9
            return;
33
        }
34
35 3
        throw new InvalidArgumentException(
36
            'This constructor expects a string argument.'
37 3
        );
38
    }
39
40
    /**
41
     * Build the command string to be executed.
42
     *
43
     * @param array $options An array of options to use for building the
44
     * command.
45
     * @return string
46
     */
47
    abstract public function build($options);
48
}
49