Starter::start()   A
last analyzed

Complexity

Conditions 4
Paths 8

Size

Total Lines 15
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.2
c 0
b 0
f 0
cc 4
eloc 6
nc 8
nop 3
1
<?php
2
3
namespace Consigliere\Components;
4
5
use Illuminate\Filesystem\Filesystem;
6
use Symfony\Component\Finder\Finder;
7
8
class Starter
9
{
10
    /**
11
     * Load the workbench vendor auto-load files.
12
     *
13
     * @param string $path
14
     * @param \Symfony\Component\Finder\Finder $finder
15
     * @param \Illuminate\Filesystem\Filesystem $files
16
     */
17
    public static function start($path, Finder $finder = null, Filesystem $files = null)
18
    {
19
        $finder = $finder ?: new Finder();
20
21
        // We will use the finder to locate all "autoload.php" files in the workbench
22
        // directory, then we will include them each so that they are able to load
23
        // the appropriate classes and file used by the given workbench package.
24
        $files = $files ?: new Filesystem();
25
26
        $autoloads = $finder->in($path)->files()->name('autoload.php')->depth('<= 3')->followLinks();
27
28
        foreach ($autoloads as $file) {
29
            $files->requireOnce($file->getRealPath());
30
        }
31
    }
32
}
33