SameMatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 4
Bugs 0 Features 2
Metric Value
dl 0
loc 27
rs 10
c 4
b 0
f 2
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
 * 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