| | | 1 | | using System.Linq; |
| | | 2 | | using System.Text.RegularExpressions; |
| | | 3 | | using JetBrains.Annotations; |
| | | 4 | | |
| | | 5 | | namespace WireMock.Matchers |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// WildcardMatcher |
| | | 9 | | /// </summary> |
| | | 10 | | /// <seealso cref="RegexMatcher" /> |
| | | 11 | | public class WildcardMatcher : RegexMatcher |
| | | 12 | | { |
| | | 13 | | private readonly string[] _patterns; |
| | | 14 | | |
| | | 15 | | /// <summary> |
| | | 16 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 17 | | /// </summary> |
| | | 18 | | /// <param name="pattern">The pattern.</param> |
| | | 19 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 30 | 20 | | public WildcardMatcher([NotNull] string pattern, bool ignoreCase = false) : this(new[] { pattern }, ignoreCase) |
| | 30 | 21 | | { |
| | 30 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <param name="matchBehaviour">The match behaviour.</param> |
| | | 28 | | /// <param name="pattern">The pattern.</param> |
| | | 29 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 264 | 30 | | public WildcardMatcher(MatchBehaviour matchBehaviour, [NotNull] string pattern, bool ignoreCase = false) : this( |
| | 265 | 31 | | { |
| | 265 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 36 | | /// </summary> |
| | | 37 | | /// <param name="patterns">The patterns.</param> |
| | | 38 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 30 | 39 | | public WildcardMatcher([NotNull] string[] patterns, bool ignoreCase = false) : this(MatchBehaviour.AcceptOnMatch |
| | 30 | 40 | | { |
| | 30 | 41 | | } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 45 | | /// </summary> |
| | | 46 | | /// <param name="matchBehaviour">The match behaviour.</param> |
| | | 47 | | /// <param name="patterns">The patterns.</param> |
| | | 48 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 602 | 49 | | public WildcardMatcher(MatchBehaviour matchBehaviour, [NotNull] string[] patterns, bool ignoreCase = false) : ba |
| | 300 | 50 | | { |
| | 300 | 51 | | _patterns = patterns; |
| | 300 | 52 | | } |
| | | 53 | | |
| | | 54 | | /// <inheritdoc cref="IStringMatcher.GetPatterns"/> |
| | | 55 | | public override string[] GetPatterns() |
| | 3 | 56 | | { |
| | 3 | 57 | | return _patterns; |
| | 3 | 58 | | } |
| | | 59 | | |
| | | 60 | | /// <inheritdoc cref="IMatcher.Name"/> |
| | 2 | 61 | | public override string Name => "WildcardMatcher"; |
| | | 62 | | } |
| | | 63 | | } |