FileFinder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A findPHPFilesByPath() 0 15 3
1
<?php
2
3
/*
4
 * This file is part of the php-formatter package
5
 *
6
 * Copyright (c) 2014-2016 Marc Morera
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * Feel free to edit as you please, and have fun.
12
 *
13
 * @author Marc Morera <[email protected]>
14
 */
15
16
namespace Mmoreram\PHPFormatter\Finder;
17
18
use Symfony\Component\Finder\Finder;
19
20
/**
21
 * Class FileFinder.
22
 */
23
class FileFinder
24
{
25
    /**
26
     * Find all php files by path.
27
     *
28
     * @param string $path Path
29
     *
30
     * @return Finder Finder iterable object with all PHP found files in path
31
     */
32
    public function findPHPFilesByPath($path)
33
    {
34
        $finder = new Finder();
35
36
        if (file_exists($path) && !is_dir($path)) {
37
            $finder->append([0 => $path]);
38
        } else {
39
            $finder
40
                ->files()
41
                ->in($path)
42
                ->name('*.php');
43
        }
44
45
        return $finder;
46
    }
47
}
48