File tree 9 files changed +51
-38
lines changed
9 files changed +51
-38
lines changed Original file line number Diff line number Diff line change 34
34
},
35
35
"extra" : {
36
36
"branch-alias" : {
37
- "dev-master" : " 1.1 -dev"
37
+ "dev-master" : " 1.2 -dev"
38
38
}
39
39
}
40
40
}
Original file line number Diff line number Diff line change 16
16
);
17
17
}
18
18
19
+ /**
20
+ * @deprecated since 1.1, to be removed in 2.0. Use SimpleFactory and object approach instead
21
+ */
19
22
if (!function_exists ('match ' )) {
20
23
/**
21
24
* @param mixed $value
Original file line number Diff line number Diff line change 1
1
<?php
2
2
namespace Coduo \PHPMatcher ;
3
3
4
- use Coduo \PHPMatcher \Matcher \PropertyMatcher ;
4
+ use Coduo \PHPMatcher \Matcher \ValueMatcher ;
5
5
6
6
class Matcher
7
7
{
8
8
/**
9
- * @var Matcher\PropertyMatcher
9
+ * @var ValueMatcher
10
10
*/
11
11
private $ matcher ;
12
12
13
13
/**
14
- * @param PropertyMatcher $matcher
14
+ * @param ValueMatcher $matcher
15
15
*/
16
- public function __construct (PropertyMatcher $ matcher )
16
+ public function __construct (ValueMatcher $ matcher )
17
17
{
18
18
$ this ->matcher = $ matcher ;
19
19
}
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ class ArrayMatcher extends Matcher
20
20
private $ accessor ;
21
21
22
22
/**
23
- * @param PropertyMatcher $propertyMatcher
23
+ * @param ValueMatcher $propertyMatcher
24
24
*/
25
- public function __construct (PropertyMatcher $ propertyMatcher )
25
+ public function __construct (ValueMatcher $ propertyMatcher )
26
26
{
27
27
$ this ->propertyMatcher = $ propertyMatcher ;
28
28
}
Original file line number Diff line number Diff line change 7
7
class ChainMatcher extends Matcher
8
8
{
9
9
/**
10
- * @var array|PropertyMatcher []
10
+ * @var array|ValueMatcher []
11
11
*/
12
12
private $ matchers ;
13
13
14
14
/**
15
- * @param array|PropertyMatcher [] $matchers
15
+ * @param array|ValueMatcher [] $matchers
16
16
*/
17
17
public function __construct (array $ matchers = array ())
18
18
{
19
19
$ this ->matchers = $ matchers ;
20
20
}
21
21
22
22
/**
23
- * @param PropertyMatcher $matcher
23
+ * @param ValueMatcher $matcher
24
24
*/
25
- public function addMatcher (PropertyMatcher $ matcher )
25
+ public function addMatcher (ValueMatcher $ matcher )
26
26
{
27
27
$ this ->matchers [] = $ matcher ;
28
28
}
Original file line number Diff line number Diff line change @@ -13,9 +13,9 @@ class JsonMatcher extends Matcher
13
13
private $ matcher ;
14
14
15
15
/**
16
- * @param PropertyMatcher $matcher
16
+ * @param ValueMatcher $matcher
17
17
*/
18
- public function __construct (PropertyMatcher $ matcher )
18
+ public function __construct (ValueMatcher $ matcher )
19
19
{
20
20
$ this ->matcher = $ matcher ;
21
21
}
Original file line number Diff line number Diff line change 2
2
3
3
namespace Coduo \PHPMatcher \Matcher ;
4
4
5
- abstract class Matcher implements PropertyMatcher
5
+ abstract class Matcher implements ValueMatcher
6
6
{
7
7
/**
8
8
* @var string|null
Original file line number Diff line number Diff line change 2
2
3
3
namespace Coduo \PHPMatcher \Matcher ;
4
4
5
- interface PropertyMatcher
5
+ /**
6
+ * @deprecated since 1.1, to be removed in 2.0. Use ValueMatcher instead
7
+ */
8
+ interface PropertyMatcher extends ValueMatcher
6
9
{
7
- /**
8
- * Matches value against the pattern
9
- *
10
- * @param $value
11
- * @param $pattern
12
- * @return boolean
13
- */
14
- public function match ($ value , $ pattern );
15
-
16
- /**
17
- * Checks if matcher can match the pattern
18
- *
19
- * @param $pattern
20
- * @return boolean
21
- */
22
- public function canMatch ($ pattern );
23
-
24
- /**
25
- * Returns a string description why matching failed
26
- *
27
- * @return null|string
28
- */
29
- public function getError ();
30
10
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Coduo \PHPMatcher \Matcher ;
4
+
5
+ interface ValueMatcher
6
+ {
7
+ /**
8
+ * Matches value against the pattern
9
+ *
10
+ * @param $value
11
+ * @param $pattern
12
+ * @return boolean
13
+ */
14
+ public function match ($ value , $ pattern );
15
+
16
+ /**
17
+ * Checks if matcher can match the pattern
18
+ *
19
+ * @param $pattern
20
+ * @return boolean
21
+ */
22
+ public function canMatch ($ pattern );
23
+
24
+ /**
25
+ * Returns a string description why matching failed
26
+ *
27
+ * @return null|string
28
+ */
29
+ public function getError ();
30
+ }
You can’t perform that action at this time.
0 commit comments