private function getColors($flowers, $noSort = FALSE) { $colors = array(); foreach ($flowers as $flower) { $colors[] = $flower->color; } if (!$noSort) { sort($colors); } return implode(',', $colors); }