Skip to content

Commit e641c70

Browse files
committed
Refactor the NodeColumn::getTruncateValue method
Removes the unnecessary switch construct. Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
1 parent 3890d11 commit e641c70

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

libraries/classes/Navigation/Nodes/NodeColumn.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,12 @@ private function getDisplayName($item)
100100
*
101101
* @return string truncated value
102102
*/
103-
public function getTruncateValue($key, $value)
103+
private function getTruncateValue($key, $value)
104104
{
105-
$retval = '';
106-
107-
switch ($key) {
108-
case 'default':
109-
strlen($value) > 6 ? $retval .= substr($value, 0, 6) . '...' : $retval = $value;
110-
break;
111-
default:
112-
$retval = $value;
113-
break;
105+
if ($key === 'default' && strlen($value) > 6) {
106+
return substr($value, 0, 6) . '...';
114107
}
115108

116-
return $retval;
109+
return $value;
117110
}
118111
}

0 commit comments

Comments
 (0)