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

EqualMatcher::doMatch()   A

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
c 1
b 0
f 1
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
 * 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 {{actual}} not to equal {{expected}}'
37
        ]);
38
    }
39
}
40