Completed
Push — trunk ( e8681e...314ee9 )
by SuperNova.WS
13:57
created

TContainer::__set()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 2
nop 2
dl 0
loc 2
ccs 0
cts 2
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by Gorlum 08.01.2018 15:16
4
 */
5
6
namespace Traits;
7
8
9
trait TContainer {
10
  /**
11
   * @return \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