/** * @param string|array $source * @param string|array $value * @param string $delimiter If you are getting back a string, this is the implosion delimiter * * @return array|string */ public static function addValue($source, $value, $delimiter = ' ') { $_values = !is_array($source) ? explode(' ', trim($source)) : $source; $_newValues = Convert::createArray($value); foreach ($_newValues as $_newValue) { if (!in_array($_newValue, $_values)) { $_values[] = $_newValue; } } return is_array($source) ? $_values : ltrim(implode($delimiter, $_values), $delimiter); }