Directory   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 7
lcom 1
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A analyse() 0 6 1
B getFinder() 0 26 6
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 Directory extends Spider
17
{
18
    protected $finder = false;
19
20
    public function analyse()
21
    {
22
        // find all files in the current directory
23
        DebugHelper::debug('Analisando Pasta: '.$this->getTargetPath());
24
        $this->followChildrens($this->getFinder());
25
    }
26
27
    public function getFinder($fast = true)
28
    {
29
30
        try {
31
            if (!$this->finder) {
32
                $this->finder = new Finder();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Symfony\Component\Finder\Finder() of type object<Symfony\Component\Finder\Finder> is incompatible with the declared type boolean of property $finder.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
33
                $this->finder->ignoreUnreadableDirs();
34
                if ($fast) {
35
                    if (file_exists($this->getTargetPath().'gitignore')) {
36
                        // excludes files/directories matching the .gitignore patterns
37
                        $this->finder->ignoreVCSIgnored(true);
38
                    }
39
                }
40
                // Ignorar Recursividade
41
                $this->finder->depth('== 0');
42
                // Buscar Pastas e Arquivos
43
                $this->finder->in($this->getTargetPath());
44
            }
45
        } catch (\Symfony\Component\Finder\Exception\DirectoryNotFoundException $e) {
46
            DebugHelper::warning('Diretório não existe: '. $e->getMessage());
47
        } catch (Exception $e) {
0 ignored issues
show
Bug introduced by
The class Finder\Spider\Exception does not exist. Did you forget a USE statement, or did you not list all dependencies?

Scrutinizer analyzes your composer.json/composer.lock file if available to determine the classes, and functions that are defined by your dependencies.

It seems like the listed class was neither found in your dependencies, nor was it found in the analyzed files in your repository. If you are using some other form of dependency management, you might want to disable this analysis.

Loading history...
48
            DebugHelper::warning('Exceção capturada: '. $e->getMessage());
49
        }
50
51
        return $this->finder;
52
    }
53
54
}