Completed
Push — work-fleets ( 7aaf68...e155c0 )
by SuperNova.WS
06:30
created

PropertyHiderInArray   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 60
ccs 0
cts 15
cp 0
rs 10
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A isPropertyActionAvailable() 0 4 1
A setProperty() 0 6 1
A getProperty() 0 3 1
A __isset() 0 3 1
A isContainerEmpty() 0 3 1
1
<?php
2
3
/**
4
 * Class PropertyHiderInArray
5
 *
6
 * Holding properties in internal container
7
 */
8
class PropertyHiderInArray extends PropertyHider {
9
10
  protected $_data = array();
11
12
  /**
13
   * Method checks if action is available for named property
14
   *
15
   * @param string $name
16
   * @param string $action
17
   *
18
   * @return bool
19
   */
20
  protected function isPropertyActionAvailable($name, $action = '') {
21
    // By default all action available for existing properties
22
    return true;
23
  }
24
25
  /**
26
   * Internal method that make real changes to property value
27
   * May be override in child class
28
   *
29
   * @param string $name
30
   * @param mixed  $value
31
   *
32
   * @return mixed
33
   */
34
  protected function setProperty($name, $value) {
35
    // TODO: Change property only if value differs ????
0 ignored issues
show
Unused Code Comprehensibility introduced by
48% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
36
//      if($this->{$this->getPhysicalPropertyName($name)} !== $value) {
37
//      }
38
    return $this->_data[$name] = $value;
39
  }
40
41
  /**
42
   * Internal method that make really reads property value
43
   * May be override in child class
44
   *
45
   * @param string $name
46
   * @param mixed  $value - ignored. Used for compatibility
47
   *
48
   * @return mixed
49
   */
50
  protected function getProperty($name, $value = null) {
51
    return $this->_data[$name];
52
  }
53
54
  public function __isset($name) {
55
    return isset($this->_data[$name]);
56
  }
57
58
  /**
59
   * Is container empty
60
   *
61
   * @return boolean
62
   */
63
  public function isContainerEmpty() {
64
    return empty($this->_data);
65
  }
66
67
}
68