Loader   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 61
ccs 0
cts 8
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getFileList() 0 4 1
A setPackagePath() 0 4 1
getSource() 0 1 ?
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
    /**
19
     * The filesystem instance.
20
     *
21
     * @var \Illuminate\Filesystem\Filesystem
22
     */
23
    protected $files;
24
25
    /**
26
     * The path to the application's packages.
27
     *
28
     * @var string
29
     */
30
    protected $packagePath;
31
32
    /**
33
     * Create a new publisher instance.
34
     *
35
     * @param \Illuminate\Filesystem\Filesystem $files
36
     * @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...
37
     */
38
    public function __construct(Filesystem $files)
39
    {
40
        $this->files = $files;
41
    }
42
43
    /**
44
     * Publish files from a given path.
45
     *
46
     * @param string $package
47
     * @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...
48
     *
49
     * @return bool
50
     */
51
    public function getFileList($package)
52
    {
53
        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...
54
    }
55
56
    /**
57
     * Set the default package path.
58
     *
59
     * @param string $packagePath
60
     */
61
    public function setPackagePath($packagePath)
62
    {
63
        $this->packagePath = $packagePath;
64
    }
65
66
    /**
67
     * Get the source directory to publish.
68
     *
69
     * @param string $packagePath
70
     *
71
     * @return string
72
     *
73
     * @throws \InvalidArgumentException
74
     */
75
    abstract protected function getSource($packagePath);
76
}
77