1 | <?php |
||
23 | class Subset extends MatcherAbstract |
||
24 | { |
||
25 | private $expected; |
||
26 | private $strict = true; |
||
27 | |||
28 | /** |
||
29 | * @param array $expected Expected subset of data |
||
30 | * @param bool $strict Whether to run a strict or loose comparison |
||
31 | */ |
||
32 | 8 | public function __construct(array $expected, $strict = true) |
|
37 | |||
38 | /** |
||
39 | * @param array $expected Expected subset of data |
||
40 | * |
||
41 | * @return Subset |
||
42 | */ |
||
43 | 2 | public static function strict(array $expected) |
|
47 | |||
48 | /** |
||
49 | * @param array $expected Expected subset of data |
||
50 | * |
||
51 | * @return Subset |
||
52 | */ |
||
53 | 1 | public static function loose(array $expected) |
|
57 | |||
58 | /** |
||
59 | * Check if the actual value matches the expected. |
||
60 | * |
||
61 | * @param mixed $actual |
||
62 | * @return bool |
||
63 | */ |
||
64 | 7 | public function match(&$actual) |
|
76 | |||
77 | /** |
||
78 | * Return a string representation of this Matcher |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | public function __toString() |
||
92 | } |
||
93 |