ContainerPlus::__set()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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