Conditions | 4 |
Paths | 4 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 13 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
102 | 48 | function __clone() |
|
103 | { |
||
104 | 48 | if (!is_object($this->config)) { |
|
105 | 45 | return null; |
|
106 | } |
||
107 | |||
108 | 21 | if (!$this->config instanceof Scope) { |
|
109 | 18 | return $this->config = clone $this->config; |
|
110 | } |
||
111 | |||
112 | 3 | $scope = $this->config->scope(); |
|
113 | |||
114 | 3 | if (!$scope instanceof self) { |
|
115 | 2 | return $this->config = clone $this->config; |
|
116 | } |
||
117 | |||
118 | 1 | $this->config->scope(false); |
|
119 | |||
120 | 1 | $clone = clone $this->config; |
|
121 | 1 | $clone->scope($this); |
|
122 | |||
123 | 1 | $this->config->scope($scope); |
|
124 | |||
125 | 1 | return $this->config = $clone; |
|
126 | } |
||
127 | } |
||
128 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.