public function value($value, $type = null) {
		if (!isset($value)) {
			return null;
		}

		$type = self::dataTypeOrDefault($type);

		if ($type === self::DATA_TYPE_EMAIL || $type === self::DATA_TYPE_URL || $type === self::DATA_TYPE_IP) {
			$value = \trim($value);
		}

		$filtered = \filter_var($value, self::determineFilterMode($type), self::composeFilterFlags($type));

		return self::applyPostProcessing($filtered, $type);
	}