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: * SameMatcher determines if an actual value is identical to the expected value.
9: * @package Peridot\Leo\Matcher
10: */
11: class SameMatcher extends AbstractMatcher
12: {
13: /**
14: * Match if the actual value is identical to the expected value using an ===
15: * comparison.
16: *
17: * @param mixed $actual
18: * @return bool
19: */
20: public function doMatch($actual)
21: {
22: return $this->expected === $actual;
23: }
24:
25: /**
26: * {@inheritdoc}
27: *
28: * @return TemplateInterface
29: */
30: public function getDefaultTemplate()
31: {
32: return new ArrayTemplate([
33: 'default' => 'Expected {{expected}} to be identical to {{actual}}',
34: 'negated' => 'Expected {{expected}} not to be identical to {{actual}}'
35: ]);
36: }
37: }
38: