Conditions | 3 |
Paths | 4 |
Total Lines | 11 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
42 | 2 | public function mergeStringToField($fieldName, $string) |
|
43 | { |
||
44 | 2 | $string = (string) $string; |
|
45 | 2 | $fieldIsSet = mb_strlen($this->$fieldName) > 0 && !is_array($this->$fieldName); |
|
46 | |||
47 | 2 | if (!$fieldIsSet) { |
|
48 | 2 | $this->$fieldName = $string; |
|
49 | } else { |
||
50 | 2 | $this->$fieldName.= ',' . $string; |
|
51 | } |
||
52 | } |
||
53 | } |