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

Container   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 21
rs 10
c 1
b 0
f 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 4 2
A has() 0 4 1
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
}