| | | 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="IMatcher" /> |
| | | 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> |
| | 57 | 20 | | public WildcardMatcher([NotNull] string pattern, bool ignoreCase = false) : this(new [] { pattern }, ignoreCase) |
| | 57 | 21 | | { |
| | 57 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Initializes a new instance of the <see cref="WildcardMatcher"/> class. |
| | | 26 | | /// </summary> |
| | | 27 | | /// <param name="patterns">The patterns.</param> |
| | | 28 | | /// <param name="ignoreCase">IgnoreCase</param> |
| | 118 | 29 | | public WildcardMatcher([NotNull] string[] patterns, bool ignoreCase = false) : base(patterns.Select(pattern => " |
| | 59 | 30 | | { |
| | 59 | 31 | | _patterns = patterns; |
| | 59 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Gets the pattern. |
| | | 36 | | /// </summary> |
| | | 37 | | /// <returns>Pattern</returns> |
| | | 38 | | public override string[] GetPatterns() |
| | 0 | 39 | | { |
| | 0 | 40 | | return _patterns; |
| | 0 | 41 | | } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Gets the name. |
| | | 45 | | /// </summary> |
| | | 46 | | /// <returns> |
| | | 47 | | /// Name |
| | | 48 | | /// </returns> |
| | | 49 | | public override string GetName() |
| | 0 | 50 | | { |
| | 0 | 51 | | return "WildcardMatcher"; |
| | 0 | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |