1: <?php
2: namespace Peridot\Leo\Matcher;
3:
4: /**
5: * A Match is the result of MatcherInterface::match($actual).
6: *
7: * @package Peridot\Leo\Matcher
8: */
9: class Match
10: {
11: /**
12: * @var bool
13: */
14: protected $match;
15:
16: /**
17: * @var mixed
18: */
19: protected $expected;
20:
21: /**
22: * @var mixed
23: */
24: protected $actual;
25:
26: /**
27: * @var bool
28: */
29: protected $isNegated;
30:
31: /**
32: * @param bool $isMatch
33: * @param mixed $expected
34: * @param mixed $actual
35: * @param bool $isNegated
36: */
37: public function __construct($isMatch, $expected, $actual, $isNegated)
38: {
39: $this->match = $isMatch;
40: $this->expected = $expected;
41: $this->actual = $actual;
42: $this->isNegated = $isNegated;
43: }
44:
45: /**
46: * Return whether or not a match succeeded.
47: *
48: * @return bool
49: */
50: public function isMatch()
51: {
52: return $this->match;
53: }
54:
55: /**
56: * Get the actual value used in the match.
57: *
58: * @return mixed
59: */
60: public function getActual()
61: {
62: return $this->actual;
63: }
64:
65: /**
66: * Get the expected value used in the match.
67: *
68: * @return mixed
69: */
70: public function getExpected()
71: {
72: return $this->expected;
73: }
74:
75: /**
76: * Returns whether or not the match was negated.
77: *
78: * @return boolean
79: */
80: public function isNegated()
81: {
82: return $this->isNegated;
83: }
84:
85: /**
86: * Set the actual value used in the match.
87: *
88: * @param mixed $actual
89: * @return $this
90: */
91: public function setActual($actual)
92: {
93: $this->actual = $actual;
94: return $this;
95: }
96:
97: /**
98: * Set the expected value used in the match.
99: *
100: * @param mixed $expected
101: * @return $this
102: */
103: public function setExpected($expected)
104: {
105: $this->expected = $expected;
106: return $this;
107: }
108: }
109: