EqualMatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A doMatch() 0 4 1
A getDefaultTemplate() 0 7 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
 * EqualMatcher determines if the expected value and the actual value are loosely equal. Peroforms
10
 * an == comparison.
11
 *
12
 * @package Peridot\Leo\Matcher
13
 */
14
class EqualMatcher extends AbstractMatcher
15
{
16
    /**
17
     * Determine if value is loosely equal to the expected
18
     * value.
19
     *
20
     * @param $actual
21
     * @return bool
22
     */
23
    public function doMatch($actual)
24
    {
25
        return $this->expected == $actual;
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     *
31
     * @return TemplateInterface
32
     */
33
    public function getDefaultTemplate()
34
    {
35
        return new ArrayTemplate([
36
            'default' => 'Expected {{expected}}, got {{actual}}',
37
            'negated' => 'Expected {{actual}} not to equal {{expected}}',
38
        ]);
39
    }
40
}
41