Completed
Pull Request — master (#24)
by Erin
02:47
created

SameMatcher   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 6
Bugs 1 Features 4
Metric Value
wmc 2
c 6
b 1
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
 * 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