RouteLoader::getSource()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 10
cp 0
rs 9.4285
cc 3
eloc 9
nc 3
nop 1
crap 12
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 InvalidArgumentException;
15
16
class RouteLoader extends Loader
17
{
18
    /**
19
     * Get the source asset directory to publish.
20
     *
21
     * @param string $packagePath
22
     *
23
     * @return string
24
     *
25
     * @throws \InvalidArgumentException
26
     */
27
    protected function getSource($packagePath)
28
    {
29
        $sources = [
30
            "{$packagePath}/resources/routes.php",
31
            "{$packagePath}/src/Http/routes.php",
32
            "{$packagePath}/src/routes.php",
33
        ];
34
35
        foreach ($sources as $source) {
36
            if ($this->files->isFile($source)) {
37
                return $source;
38
            }
39
        }
40
41
        throw new InvalidArgumentException('Routes not found.');
42
    }
43
}
44