Passed
Push — master ( 71e346...ca9e15 )
by Brian
02:28
created

menus_path()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 11
rs 10
cc 2
nc 2
nop 1
1
<?php
2
3
use Illuminate\Container\Container;
4
use Illuminate\Contracts\Config\Repository as ConfigRepository;
5
6
if (! function_exists('menus_path')) {
7
    /**
8
     * Get the path to the menus directory.
9
     */
10
    function menus_path(string $path = ''): string
11
    {
12
        $app = Container::getInstance();
13
14
        $config = $app->make(ConfigRepository::class);
15
16
        $menusDir = $config->get('ussd.menus-path');
17
18
        $path = $path ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : $path;
19
20
        return $app->basePath($menusDir.$path);
0 ignored issues
show
introduced by
The method basePath() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        return $app->/** @scrutinizer ignore-call */ basePath($menusDir.$path);
Loading history...
21
    }
22
}
23