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

EqualMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 7
Bugs 0 Features 4
Metric Value
wmc 2
c 7
b 0
f 4
lcom 1
cbo 2
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doMatch() 0 4 1
A getDefaultTemplate() 0 7 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