File::analyse()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
1
<?php
2
namespace Finder\Spider;
3
4
use Finder\Logic\Output\AbstractOutput;
5
use Finder\Logic\Output\Filter\OutputFilterInterface;
6
use Finder\Logic\Output\TriggerableInterface;
7
8
use Symfony\Component\Finder\Finder;
9
use Finder\Contracts\Spider\Spider;
10
11
use Support\Helps\DebugHelper;
12
13
/**
14
 * Run all script analysers and outputs their result.
15
 */
16
class File extends Spider
17
{
18
    public function analyse()
19
    {
20
        $absoluteFilePath = $this->getTargetPath();
0 ignored issues
show
Unused Code introduced by
$absoluteFilePath is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
21
        $fileNameWithExtension = $this->target->getRelativePathname();
0 ignored issues
show
Bug introduced by
The method getRelativePathname cannot be called on $this->target (of type boolean).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
Unused Code introduced by
$fileNameWithExtension is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
22
        
23
        $class = '\\Finder\\Spider\\Extensions\\'.ucfirst($this->getTarget()->getExtension());
0 ignored issues
show
Bug introduced by
The method getExtension cannot be called on $this->getTarget() (of type boolean).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
24
        DebugHelper::info('Analisando Arquivo: '.$this->getTargetPath());
25
        if (class_exists($class)) {
26
            $analyse = new $class($this->getTarget(), $this->getMetric());
0 ignored issues
show
Unused Code introduced by
$analyse is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
27
28
        }
29
30
        // dd($absoluteFilePath, $fileNameWithExtension, $this->target);
31
        // ...
32
    }
33
}