RoutePublisher   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSource() 0 15 3
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\Publisher;
13
14
use InvalidArgumentException;
15
16
class RoutePublisher extends Publisher
17
{
18
    /**
19
     * Get the source configuration directory to publish.
20
     *
21
     * @param string $package
0 ignored issues
show
Documentation introduced by
There is no parameter named $package. Did you maybe mean $packagePath?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.

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

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

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

Loading history...
22
     * @param string $packagePath
23
     *
24
     * @return string
25
     *
26
     * @throws \InvalidArgumentException
27
     */
28
    protected function getSource($packagePath)
29
    {
30
        $sources = [
31
            "{$packagePath}/resources/routes",
32
            "{$packagePath}/routes",
33
        ];
34
35
        foreach ($sources as $source) {
36
            if ($this->files->isDirectory($source)) {
37
                return $source;
38
            }
39
        }
40
41
        throw new InvalidArgumentException('Configuration not found.');
42
    }
43
}
44