Passed
Push — master ( 69774c...de7969 )
by Sebastian
02:46
created

Options::getAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 1
cts 1
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * This file is part of CaptainHook
5
 *
6
 * (c) Sebastian Feldmann <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace CaptainHook\App\Config;
13
14
/**
15
 * Class Options
16
 *
17
 * @package CaptainHook
18
 * @author  Sebastian Feldmann <[email protected]>
19
 * @link    https://github.com/captainhookphp/captainhook
20
 * @since   Class available since Release 1.0.0
21
 */
22
class Options
23
{
24
    /**
25
     * Map of options
26
     *
27
     * @var array<string, string>
28
     */
29
    private $options;
30
31
    /**
32
     * Options constructor
33
     *
34
     * @param array<string, string> $options
35 68
     */
36
    public function __construct(array $options)
37 68
    {
38 68
        $this->options = $options;
39
    }
40
41
    /**
42
     * Return a option value
43
     *
44
     * @param  string $name
45
     * @param  mixed  $default
46
     * @return mixed
47 18
     */
48
    public function get(string $name, $default = null)
49 18
    {
50
        return isset($this->options[$name]) ? $this->options[$name] : $default;
51
    }
52
53
    /**
54
     * Return all options
55
     *
56
     * @return array
57 14
     */
58
    public function getAll(): array
59 14
    {
60
        return $this->options;
61
    }
62
}
63