config_path()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 1
nc 2
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
use Illuminate\Container\Container;
4
5
if (!function_exists('app')) {
6
    /**
7
     * Get the available container instance.
8
     *
9
     * @param  string $abstract
10
     * @param  array $parameters
11
     * @return mixed|Container
12
     */
13
    function app($abstract = null, array $parameters = [])
14
    {
15
        if (is_null($abstract)) {
16
            return Container::getInstance();
17
        }
18
19
        return Container::getInstance()->make($abstract, $parameters);
20
    }
21
}
22
23
if (!function_exists('config')) {
24
    /**
25
     * Get / set the specified configuration value.
26
     *
27
     * If an array is passed as the key, we will assume you want to set an array of values.
28
     *
29
     * @param  array|string $key
30
     * @param  mixed $default
31
     * @return mixed|\Illuminate\Config\Repository|string
32
     */
33
    function config($key = null, $default = null)
34
    {
35
        if (is_null($key)) {
36
            return app('config');
37
        }
38
39
        if (is_array($key)) {
40
            app('config')->set($key);
41
42
            return;
43
        }
44
45
        return app('config')->get($key) ?? $default;
46
    }
47
}
48
49
if (!function_exists('config_path')) {
50
    /**
51
     * Get the configuration path.
52
     *
53
     * @param  string $path
54
     * @return string
55
     */
56
    function config_path($path = '')
57
    {
58
        return app()->make('path.config') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
59
    }
60
}
61
62
if (!function_exists('base_path')) {
63
    /**
64
     * Get the path to the base of the install.
65
     *
66
     * @param  string $path
67
     * @return string
68
     */
69
    function base_path($path = '')
70
    {
71
        return app()->basePath() . ($path ? DIRECTORY_SEPARATOR . $path : $path);
0 ignored issues
show
Bug introduced by
The method basePath() does not exist on Illuminate\Container\Container. ( Ignorable by Annotation )

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

71
        return app()->/** @scrutinizer ignore-call */ basePath() . ($path ? DIRECTORY_SEPARATOR . $path : $path);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
72
    }
73
}