Completed
Pull Request — master (#22)
by Erin
02:35
created

SameMatcher::doMatch()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
c 2
b 0
f 2
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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 {{actual}} to be identical to {{expected}}',
34
            'negated' => 'Expected {{actual}} not to be identical to {{expected}}'
35
        ]);
36
    }
37
}
38