Completed
Push — master ( 629b98...606f80 )
by Brian
11:50
created

Loader::getFileList()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
/*
4
 * This file is part of Laravel Service Provider.
5
 *
6
 * (c) DraperStudio <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace DraperStudio\ServiceProvider\Loader;
13
14
use Illuminate\Filesystem\Filesystem;
15
16
abstract class Loader
17
{
18
    use \DraperStudio\ServiceProvider\FilesTrait;
19
20
    /**
21
     * The filesystem instance.
22
     *
23
     * @var \Illuminate\Filesystem\Filesystem
24
     */
25
    protected $files;
26
27
    /**
28
     * The path to the application's packages.
29
     *
30
     * @var string
31
     */
32
    protected $packagePath;
33
34
    /**
35
     * Create a new publisher instance.
36
     *
37
     * @param \Illuminate\Filesystem\Filesystem $files
38
     * @param string                            $publishPath
0 ignored issues
show
Bug introduced by
There is no parameter named $publishPath. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
39
     */
40
    public function __construct(Filesystem $files)
41
    {
42
        $this->files = $files;
43
    }
44
45
    /**
46
     * Publish files from a given path.
47
     *
48
     * @param string $package
49
     * @param string $source
0 ignored issues
show
Bug introduced by
There is no parameter named $source. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
50
     *
51
     * @return bool
52
     */
53
    public function getFileList($package)
54
    {
55
        return $this->getSource($package, $this->packagePath);
0 ignored issues
show
Unused Code introduced by
The call to Loader::getSource() has too many arguments starting with $this->packagePath.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
56
    }
57
58
    /**
59
     * Set the default package path.
60
     *
61
     * @param string $packagePath
62
     */
63
    public function setPackagePath($packagePath)
64
    {
65
        $this->packagePath = $packagePath;
66
    }
67
68
    /**
69
     * Get the source directory to publish.
70
     *
71
     * @param string $packagePath
72
     *
73
     * @return string
74
     *
75
     * @throws \InvalidArgumentException
76
     */
77
    abstract protected function getSource($packagePath);
78
}
79