1: <?php
2: namespace Peridot\Leo\Matcher;
3:
4: use Peridot\Leo\Matcher\Template\ArrayTemplate;
5: use Peridot\Leo\Matcher\Template\TemplateInterface;
6:
7: /**
8: * EqualMatcher determines if the expected value and the actual value are loosely equal. Peroforms
9: * an == comparison.
10: *
11: * @package Peridot\Leo\Matcher
12: */
13: class EqualMatcher extends AbstractMatcher
14: {
15: /**
16: * Determine if value is loosely equal to the expected
17: * value.
18: *
19: * @param $actual
20: * @return bool
21: */
22: public function doMatch($actual)
23: {
24: return $this->expected == $actual;
25: }
26:
27: /**
28: * {@inheritdoc}
29: *
30: * @return TemplateInterface
31: */
32: public function getDefaultTemplate()
33: {
34: return new ArrayTemplate([
35: 'default' => 'Expected {{expected}}, got {{actual}}',
36: 'negated' => 'Expected {{expected}} not to equal {{actual}}'
37: ]);
38: }
39: }
40: