Passed
Push — trunk ( 338765...433e05 )
by SuperNova.WS
04:23
created

TContainer::_containerTranslatePropertyName()   A

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
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 2
rs 10
ccs 0
cts 2
cp 0
crap 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())
19
      ? $this->_getContainer()->__set($this->_containerTranslatePropertyName($name), $value)
20
      : null;
21
  }
22
23
  public function __isset($name) {
24
    return is_object($this->_getContainer())
25
      ? $this->_getContainer()->__isset($this->_containerTranslatePropertyName($name))
26
      : null;
27
  }
28
29
  public function __get($name) {
30
    return is_object($this->_getContainer())
31
      ? $this->_getContainer()->__get($this->_containerTranslatePropertyName($name))
32
      : null;
33
  }
34
35
  public function __unset($name) {
36
    is_object($this->_getContainer())
37
      ? $this->_getContainer()->__unset($this->_containerTranslatePropertyName($name))
38
      : null;
39
  }
40
41
  /**
42
   * Is container contains no data
43
   *
44
   * @return bool
45
   */
46
  public function isEmpty() {
47
    return is_object($this->_getContainer()) ? $this->_getContainer()->isEmpty() : false;
48
  }
49
50
  /**
51
   * Clears container contents
52
   */
53
  public function clear() {
54
    is_object($this->_getContainer()) ? $this->_getContainer()->clear() : null;
55
  }
56
57
  public function __call($name, $arguments) {
58
    return is_object($this->_getContainer()) ? call_user_func_array([$this->_getContainer(), $name], $arguments) : null;
59
  }
60
61
  protected function _containerTranslatePropertyName($name) {
62
    return $name;
63
  }
64
65
}
66