Split comma separated values.

@param mixed $value

@return mixed
189016
protected function splitCommaSeparatedValues($value)
    {
        if (!is_array($value) || (count($value) == 1) && is_string(current($value))) {
            $value = (array) $value;
            $value = explode(',', $value[0]);
        }

        return $value;
    }
1248942
protected function wrapValue($value)
    {
        if ($value === '*') {
            return $value;
        }

        // If querying hstore
        if (preg_match('/\[(.*?)\]/', $value, $match)) {
            return (string)str_replace(array('[', ']'), '', $match[1]);
        }

        // If querying json column
        foreach ($this->jsonOperators as $operator) {
            if (stripos($value, $operator)) {
                list($value, $key) = explode($operator, $value, 2);
                return parent::wrapValue($value) . $operator . $key;
            }
        }

        return parent::wrapValue($value);
    }
1075679
public function getUserValue($value)
    {
        if (! is_array($value)) {
            if ('' == $value) {
                $value = [];
            } else {
                $value = explode($this->getSeparator(), $value);
            }
        }

        return $value;
    }
1341720
private function formatEmpty($value)
    {
        if (empty($value = \trim($value))) {
            return $value;
        }

        return $this->formatValue($value);
    }
1058684
private function parseValue($value) {
        if(is_numeric($value)) {
            return $value + 0;
        } elseif($value === "true") {
            return true;
        } elseif($value === "false") {
            return false;
        } elseif(is_array($value)) {
            return $value;
        }

        return addslashes(trim($value));
    }
859502
protected function cleanUpValue( $value ) {
		$cleanValue = [];
		if ( !is_array( $value ) ) {
			return $cleanValue;
		}
		foreach ( $value as $singleValue ) {
			$singleValue = parent::cleanUpValue( $singleValue );
			// Remove options that we don't have here
			if ( !isset( $this->fields[ $singleValue ] ) ) {
				continue;
			}
			$cleanValue[] = $singleValue;
		}
		return $cleanValue;
	}
292780
public static function format(string $value)
    {
        $value = explode(',', $value);
        if (!is_array($value)) {
            $value = [$value];
        }
        return $value;
    }
758040
protected function convertToArray($value)
    {
        if (\is_string($value)) {
            $value = [$value];
        } elseif (null === $value) {
            $value = [];
        }

        return $value;
    }
95313
private List<String> splitRRULEValues(String value) {
		List<String> values = new ArrayList<String>();
		Pattern p = Pattern.compile("#\\d+|\\d{8}T\\d{6}Z?");
		Matcher m = p.matcher(value);

		int prevIndex = 0;
		while (m.find()) {
			int end = m.end();
			String subValue = value.substring(prevIndex, end).trim();
			values.add(subValue);
			prevIndex = end;
		}
		String subValue = value.substring(prevIndex).trim();
		if (subValue.length() > 0) {
			values.add(subValue);
		}

		return values;
	}
150643
public static function parse($value)
    {
        if (is_array($value)) {
            return static::fromArray((array)$value);
        } elseif (is_string($value)) {
            return static::fromString((string)$value);
        } else {
            return null;
        }
    }
149473
public static function format($value)
    {
        $value = Utils::toString($value);
        $value = mb_strtolower($value);

        if (Utils::isZeroPrefixed($value)) {
            return $value;
        } else {
            $value = Utils::toHex($value, true);
        }
        return $value;
    }
335746
protected function parseValue($value)
  {
    if ('*' === substr($value, 0, 1)) {
      if (false !== $pos = strpos($value, '#')) {
        $value = substr($value, 1, $pos - 2);
      } else {
        $value = substr($value, 1);
      }

      if (!array_key_exists($value, $this->refs)) {
        throw new InvalidArgumentException(sprintf('Reference "%s" does not exist (%s).', $value, $this->currentLine));
      }

      return $this->refs[$value];
    }

    if (preg_match('/^(?P<separator>\||>)(?P<modifiers>\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P<comments> +#.*)?$/', $value, $matches)) {
      $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';

      return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), intval(abs($modifiers)));
    } else {
      return sfYamlInline::load($value);
    }
  }
217533
public static function toArray($value)
    {
        # If it's already an array then just pass it back
        if (is_array($value)) {
            return $value;
        }

        if ($value instanceof SerialObject) {
            return $value->asArray();
        }

        if ($value instanceof \ArrayObject) {
            return $value->getArrayCopy();
        }

        # If it's not an array then create a new array to be returned
        $array = [];

        # If a value was passed as a string/int then include it in the new array
        if ($value) {
            $array[] = $value;
        }

        return $array;
    }
314451
protected function cleanValue($value)
	{
		if (is_array($value)) {
			return array_map(function ($v) {
				return $this->cleanValue($v);
			}, $value);
		} else {
			return stripslashes($value);
		}
	}
953150
public function split($separator)
    {
        $temp = explode($separator, $this->toString());
        $list = ArrayList::asType($this->getClassName(), $temp);
        return $list;
    }
582302
public static function parseHeaderValue(string $value): array
    {
        $parts = \explode(';', $value);
        $type = \trim($parts[0]);
        unset($parts[0]);

        $parameters = [];
        foreach ($parts as $part) {
            [$k, $v] = \explode('=', $part, 2);

            $key = \strtolower(\trim($k));
            $parameters[$key] = \trim($v, ' "');
        }

        return [$type, $parameters];
    }
1177991
private static function getListFromString($value)
    {
        if (is_string($value_array = $value)) {
            $value = str_replace([',', ' '], ';', $value);
            $value_array = explode(';', $value);
        }

        if (is_array($value_array)) {
            return array_filter(array_map('trim', $value_array));
        }

        return [];
    }