ContainerPlus   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 39
rs 10
c 0
b 0
f 0
ccs 0
cts 17
cp 0
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A isEmpty() 0 3 1
A __get() 0 2 1
A __unset() 0 2 1
A __set() 0 2 1
A __isset() 0 2 1
A __call() 0 2 1
A clear() 0 2 1
1
<?php
2
3
namespace Common;
4
5
use Common\Pimple\Container;
6
7
/**
8
 * Class ContainerPlus
9
 *
10
 * Extends original container to allow access to properties and function to document them
11
 *
12
 * @package Pimple
13
 */
14
class ContainerPlus extends Container implements Interfaces\IContainer {
15
16
  public function __set($name, $value) {
17
    $this->offsetSet($name, $value);
18
  }
19
20
  public function __get($name) {
21
    return $this->offsetGet($name);
22
  }
23
24
  public function __isset($name) {
25
    return $this->offsetExists($name);
26
  }
27
28
  public function __unset($name) {
29
    $this->offsetUnset($name);
30
  }
31
32
  public function __call($name, $arguments) {
33
    return call_user_func_array($this->$name, $arguments);
34
  }
35
36
  /**
37
   * Is container contains no data
38
   *
39
   * @return bool
40
   */
41
  public function isEmpty() {
42
    $keys = $this->keys(); // TODO PHP 5.5
43
    return empty($keys);
44
  }
45
46
  /**
47
   * Clears container contents
48
   *
49
   * @return mixed
50
   */
51
  public function clear() {
52
    throw new \Exception(get_class() . '::clear() not implemented - inherited from ContainerPlus');
53
  }
54
55
}
56