SameMatcher::doMatch()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Peridot\Leo\Matcher;
4
5
use Peridot\Leo\Matcher\Template\ArrayTemplate;
6
use Peridot\Leo\Matcher\Template\TemplateInterface;
7
8
/**
9
 * SameMatcher determines if an actual value is identical to the expected value.
10
 * @package Peridot\Leo\Matcher
11
 */
12
class SameMatcher extends AbstractMatcher
13
{
14
    /**
15
     * Match if the actual value is identical to the expected value using an ===
16
     * comparison.
17
     *
18
     * @param  mixed $actual
19
     * @return bool
20
     */
21
    public function doMatch($actual)
22
    {
23
        return $this->expected === $actual;
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     *
29
     * @return TemplateInterface
30
     */
31
    public function getDefaultTemplate()
32
    {
33
        return new ArrayTemplate([
34
            'default' => 'Expected {{actual}} to be identical to {{expected}}',
35
            'negated' => 'Expected {{actual}} not to be identical to {{expected}}',
36
        ]);
37
    }
38
}
39