wrapWithBracket method

String wrapWithBracket(
  1. BracketType type
)

Implementation

String wrapWithBracket(BracketType type) {
  switch (type) {
    // Wrap with round brackets.
    case BracketType.Rounded:
      return "($this)";

    // Wrap with square brackets.
    case BracketType.Square:
      return "[$this]";

    // Wrap with curly brackets.
    case BracketType.Curly:
      return "{$this}";

    // Wrap with angle brackets.
    case BracketType.Angle:
      return "<$this>";

    // Wrap with single quotes.
    case BracketType.SingleQuote:
      return "'$this'";

    // Wrap with double quotes.
    case BracketType.DoubleQuote:
      return "\"$this\"";
  }
}