Completed
Pull Request — master (#5)
by Stefan
03:25
created

Container::get()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 2
eloc 2
nc 2
nop 2
1
<?php
2
3
namespace Nono;
4
5
/**
6
 * Simple di container without the fancy.
7
 */
8
class Container extends \ArrayObject
9
{
10
    /**
11
     * @param string     $key
12
     * @param mixed|null $default
13
     * @return mixed
14
     */
15
    public function get($key, $default = null)
16
    {
17
        return isset($this[$key]) ? $this[$key] : $default;
18
    }
19
20
    /**
21
     * @param string $key
22
     * @return bool
23
     */
24
    public function has($key)
25
    {
26
        return isset($this[$key]);
27
    }
28
}