File tree 1 file changed +12
-2
lines changed
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
class JsonMatcher implements PropertyMatcher
6
6
{
7
+ const REPLACE_PATTERN = '/([^"])@(integer|string|array|double|wildcard|boolean)@([^"])/ ' ;
8
+
7
9
/**
8
10
* @var
9
11
*/
@@ -41,11 +43,19 @@ public function canMatch($pattern)
41
43
private function isValidJson ($ string )
42
44
{
43
45
@json_decode ($ string , true );
44
- return (json_last_error () == JSON_ERROR_NONE );
46
+ return (json_last_error () === JSON_ERROR_NONE );
45
47
}
46
48
49
+ /**
50
+ * Wraps placeholders which arent wrapped with quotes yet
51
+ *
52
+ * @param $pattern
53
+ * @return mixed
54
+ */
47
55
private function transformPattern ($ pattern )
48
56
{
49
- return preg_replace ('/([^"])@(integer|string|array|double|wildcard|boolean)@([^"])/ ' , '$1"@$2@"$3 ' , $ pattern );
57
+ $ replacement = '$1"@$2@"$3 ' ;
58
+ return preg_replace (self ::REPLACE_PATTERN , $ replacement , $ pattern );
50
59
}
60
+
51
61
}
You can’t perform that action at this time.
0 commit comments