Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
17 | 8 | public function mergeStringToField($string, $fieldName) |
|
18 | { |
||
19 | 8 | $string = (string) $string; |
|
20 | 8 | $fieldIsSet = mb_strlen($this->$fieldName) > 0 && !is_array($this->$fieldName); |
|
21 | |||
22 | 8 | if (!$fieldIsSet) { |
|
23 | 8 | $this->$fieldName = $string; |
|
24 | 8 | } else { |
|
25 | 6 | $this->$fieldName .= ',' . $string; |
|
26 | } |
||
27 | } |
||
28 | } |