Passed
Push — master ( d62b89...abb8c8 )
by Michiel
06:34
created

DefaultPHPCPDResultFormatter   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
dl 0
loc 21
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A processClones() 0 11 3
1
<?php
2
/**
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the LGPL. For more information please see
17
 * <http://phing.info>.
18
 */
19
20
use Phing\Io\File;
21
use Phing\Project;
22
use SebastianBergmann\PHPCPD\CodeCloneMap;
23
use SebastianBergmann\PHPCPD\Log\Text;
24
25
/**
26
 * Prints plain text output of phpcpd run
27
 *
28
 * @package phing.tasks.ext.phpcpd.formatter
29
 * @author  Benjamin Schultz <[email protected]>
30
 */
31
class DefaultPHPCPDResultFormatter extends PHPCPDResultFormatter
32
{
33
    /**
34
     * Processes a list of clones.
35
     *
36
     * @param CodeCloneMap   $clones
37
     * @param Project        $project
38
     * @param boolean        $useFile
39
     * @param File|null $outFile
40
     */
41 2
    public function processClones($clones, Project $project, $useFile = false, $outFile = null)
42
    {
43 2
        if ($useFile) {
44 1
            ob_start();
45
        }
46
47 2
        $logger = new Text();
48 2
        $logger->printResult($clones, true);
49
50 2
        if ($useFile) {
51 1
            file_put_contents($outFile->getPath(), ob_get_clean());
0 ignored issues
show
Bug introduced by
The method getPath() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

51
            file_put_contents($outFile->/** @scrutinizer ignore-call */ getPath(), ob_get_clean());

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
        }
53 2
    }
54
}
55