ToBeExists::reportFailed()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 4
c 1
b 0
f 1
nc 1
nop 1
dl 6
loc 6
rs 9.4285
1
<?php
2
3
/**
4
 * This file is part of expect-filesystem package.
5
 *
6
 * (c) Noritaka Horio <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
namespace expect\filesystem\matcher;
12
13
use expect\FailedMessage;
14
use expect\matcher\ReportableMatcher;
15
16 View Code Duplication
final class ToBeExists implements ReportableMatcher
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    /**
19
     * @var string
20
     */
21
    private $actual;
22
23
    public function match($actual)
24
    {
25
        $this->actual = $actual;
26
27
        return file_exists($this->actual);
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function reportFailed(FailedMessage $message)
34
    {
35
        $message->appendText('Expected ')
36
            ->appendValue($this->actual)
37
            ->appendText(' to be exists');
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function reportNegativeFailed(FailedMessage $message)
44
    {
45
        $message->appendText('Expected ')
46
            ->appendValue($this->actual)
47
            ->appendText(' not to be exists');
48
    }
49
}
50