NullMatcher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 30
rs 10
c 1
b 0
f 1
wmc 3
lcom 0
cbo 2

3 Methods

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