Completed
Push — trunk ( 0e7a2e...6a6c5e )
by SuperNova.WS
07:28
created

TContainer   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 42
ccs 0
cts 23
cp 0
rs 10
c 0
b 0
f 0
wmc 15

8 Methods

Rating   Name   Duplication   Size   Complexity  
A __unset() 0 2 2
A __call() 0 2 2
A __isset() 0 2 2
A __set() 0 2 2
A clear() 0 2 2
A __get() 0 2 2
A _getContainer() 0 2 1
A isEmpty() 0 2 2
1
<?php
2
/**
3
 * Created by Gorlum 08.01.2018 15:16
4
 */
5
6
namespace Common\Traits;
7
8
9
trait TContainer {
10
  /**
11
   * @return \Common\Interfaces\IContainer
12
   */
13
  public function _getContainer() {
14
    return null;
15
  }
16
17
  public function __set($name, $value) {
18
    is_object($this->_getContainer()) ? $this->_getContainer()->__set($name, $value) : null;
19
  }
20
21
  public function __isset($name) {
22
    return is_object($this->_getContainer()) ? $this->_getContainer()->__isset($name) : null;
23
  }
24
25
  public function __get($name) {
26
    return is_object($this->_getContainer()) ? $this->_getContainer()->__get($name) : null;
27
  }
28
29
  public function __unset($name) {
30
    is_object($this->_getContainer()) ? $this->_getContainer()->__unset($name) : null;
31
  }
32
33
  /**
34
   * Is container contains no data
35
   *
36
   * @return bool
37
   */
38
  public function isEmpty() {
39
    return is_object($this->_getContainer()) ? $this->_getContainer()->isEmpty() : false;
40
  }
41
42
  /**
43
   * Clears container contents
44
   */
45
  public function clear() {
46
    is_object($this->_getContainer()) ? $this->_getContainer()->clear() : null;
47
  }
48
49
  public function __call($name, $arguments) {
50
    return is_object($this->_getContainer()) ? call_user_func_array([$this->_getContainer(), $name], $arguments) : null;
51
  }
52
53
}
54